Submission #129223

# Submission time Handle Problem Language Result Execution time Memory
129223 2019-07-11T21:09:31 Z mraron Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
Compilation error
0 ms 0 KB
vector<int> sts;
int init=-1;
int encode (int n, int x, int y) {
	if(init==-1) {
    	init=1;
    	vector<int> sts;
    	for(int i=0;i<(1<<12);++i) {
	        int cnt=0;
	        for(int j=0;j<12;++j) {
              	cnt+=((1<<j)&i)!=0;
        	}
        	if(cnt==6) sts.push_back(i);
    	}
    }
  
  	int X=sts[x], Y=sts[Y];
  	int h=-1;
  	for(int j=0;j<12;++j) {
	    if((X&(1<<j)) && !(Y&(1<<j))) h=j+1;
  	}
  
  	return h;
}

vector<int> sts;
int init=-1;
int decode (int n, int q, int h) {
	if(init==-1) {
    	init=1;
    	vector<int> sts;
    	for(int i=0;i<(1<<12);++i) {
	        int cnt=0;
	        for(int j=0;j<12;++j) {
	            cnt+=((1<<j)&i)!=0;
        	}
	        if(cnt==6) sts.push_back(i);
    	}
    }
  
  	return (sts[q]&(1<<(h-1))>0;

}

Compilation message

encoder.cpp:1:1: error: 'vector' does not name a type
 vector<int> sts;
 ^~~~~~
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:6:6: error: 'vector' was not declared in this scope
      vector<int> sts;
      ^~~~~~
encoder.cpp:6:13: error: expected primary-expression before 'int'
      vector<int> sts;
             ^~~
encoder.cpp:12:21: error: 'sts' was not declared in this scope
          if(cnt==6) sts.push_back(i);
                     ^~~
encoder.cpp:16:10: error: 'sts' was not declared in this scope
    int X=sts[x], Y=sts[Y];
          ^~~
encoder.cpp:19:25: error: 'Y' was not declared in this scope
      if((X&(1<<j)) && !(Y&(1<<j))) h=j+1;
                         ^

decoder.cpp:1:1: error: 'vector' does not name a type
 vector<int> sts;
 ^~~~~~
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:6:6: error: 'vector' was not declared in this scope
      vector<int> sts;
      ^~~~~~
decoder.cpp:6:13: error: expected primary-expression before 'int'
      vector<int> sts;
             ^~~
decoder.cpp:12:21: error: 'sts' was not declared in this scope
          if(cnt==6) sts.push_back(i);
                     ^~~
decoder.cpp:16:12: error: 'sts' was not declared in this scope
    return (sts[q]&(1<<(h-1))>0;
            ^~~
decoder.cpp:16:31: error: expected ')' before ';' token
    return (sts[q]&(1<<(h-1))>0;
                               ^