gaddopur_coder's blog

By gaddopur_coder, history, 4 years ago, In English

Actually I solved an interactive problem on codechef but I get wrong answer (0.000) and wrong answer (-1.000). At starting I think wrong answer (-1.0000) mean s my number of query exceeded but I submit a code in which I am pretty sure that number query get exceeded but I get wrong answer (0.0000)

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

By gaddopur_coder, history, 4 years ago, In English

I solved this problem https://codeforces.com/problemset/problem/1335/F get memory limit exceed on test case 46 by this solution https://codeforces.com/contest/1335/submission/76658211 and get accepted by this solution https://codeforces.com/contest/1335/submission/77233784. I only change the type to resize and initialize the vector;

// where n*m <= 1e6;

vector<vector<int> > vis;
   vector<vector<int> > cur;
   vector<vector<int> > dis;
   vector<vector<int> > size;
   vector<vector<int> > r;
   vector<vector<char> > c;
   vector<vector<char> > path;
   
    vis.resize(n);
    path.resize(n);
    cur.resize(n); // by this get memory limit exceed.
    c.resize(n);
    dis.resize(n);
    r.resize(n);
    siz.resize(n);
    for(int i = 0; i < n; i++){
        vis[i].resize(m, 0);
        path[i].resize(m);
        cur[i].resize(m, 0);
        c[i].resize(m);
        dis[i].resize(m, -1);
        r[i].resize(m, -1);
        siz[i].resize(m, 0);
        for(int j = 0; j < m; j++){
            siz[i][j] = vis[i][j] = cur[i][j] = 0;
            r[i][j] = dis[i][j] = -1;
            cin >> c[i][j];
        }
    }


    vis.resize(n);
    path.resize(n);
    cur.resize(n);
    c.resize(n);
    dis.resize(n);
    r.resize(n);  //  by this get accepted
    siz.resize(n);
    for(int i = 0; i < n; i++){
        vis[i].resize(m);
        cur[i].resize(m);
        dis[i].resize(m);
        r[i].resize(m);
        siz[i].resize(m);
        c[i].resize(m);
        path[i].resize(m);
        for(int j = 0; j < m; j++){
            siz[i][j] = vis[i][j] = cur[i][j] = 0;
            r[i][j] = dis[i][j] = -1;
            cin >> c[i][j];
        }
    }

What wrong's in it I don't understand.

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it