Submission #1274185

#TimeUsernameProblemLanguageResultExecution timeMemory
1274185jojeonghoonPainting Squares (IOI20_squares)C++20
Compilation error
0 ms0 KiB
string ans="0000000001111111111011111111001111111010111111100011111101101111110100111111001011111100001111101110111110110011111010101111101000111110011011111001001111100010111110000011110111101110011110110101111011000111101011011110101001111010010111101000011110011101111001100111100101011110010001111000110111100010011110000101111000000111011101011101110001110110110111011010011101100101110110000111010110011101010101110101000111010011011101001001110100010111010000011100111001101011100110001110010110111001010011100100101110010000111000110011100010101110001000111000011011100001001110000010111000000011011011001101101010110110100011011001001101100010110110000011010110101100011010101001101010010110101000011010011001101001010110100100011010001001101000010110100000011001100101100110000110010101011001010001100100100110010001011001000001100011000101001100010010110001000011000010101100001000110000010011000000101100000000101010101000101010010010101000001010010100100001010001000101000010010100000001001001000100"; vector<int> paint(int n){ vector<int>ret; for(int i=0; i<n; i++) ret.push_back(ans[i]=='1'); ret.push_back(10); return ret; } int find_location(int n, vector<int>c){ if(c.back()==-1){ int k=0; for(int i:c) k+=i<0; return n-10+k; } for(int i=0; i<n; i++){ int f=1; for(int j=0; j<10; j++) if( (ans[i+j]=='1') != c[j] ) f=0; if(f){ return i; } } return -1; }

Compilation message (stderr)

squares.cpp:2:1: error: 'string' does not name a type
    2 | string ans="0000000001111111111011111111001111111010111111100011111101101111110100111111001011111100001111101110111110110011111010101111101000111110011011111001001111100010111110000011110111101110011110110101111011000111101011011110101001111010010111101000011110011101111001100111100101011110010001111000110111100010011110000101111000000111011101011101110001110110110111011010011101100101110110000111010110011101010101110101000111010011011101001001110100010111010000011100111001101011100110001110010110111001010011100100101110010000111000110011100010101110001000111000011011100001001110000010111000000011011011001101101010110110100011011001001101100010110110000011010110101100011010101001101010010110101000011010011001101001010110100100011010001001101000010110100000011001100101100110000110010101011001010001100100100110010001011001000001100011000101001100010010110001000011000010101100001000110000010011000000101100000000101010101000101010010010101000001010010100100001010001000101000010010100000001001001000100";
      | ^~~~~~
squares.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> paint(int n){
      | ^~~~~~
squares.cpp:12:26: error: 'vector' has not been declared
   12 | int find_location(int n, vector<int>c){
      |                          ^~~~~~
squares.cpp:12:32: error: expected ',' or '...' before '<' token
   12 | int find_location(int n, vector<int>c){
      |                                ^
squares.cpp: In function 'int find_location(int, int)':
squares.cpp:13:8: error: 'c' was not declared in this scope
   13 |     if(c.back()==-1){
      |        ^
squares.cpp:21:38: error: 'ans' was not declared in this scope
   21 |         for(int j=0; j<10; j++) if( (ans[i+j]=='1') != c[j] ) f=0;
      |                                      ^~~
squares.cpp:21:56: error: 'c' was not declared in this scope
   21 |         for(int j=0; j<10; j++) if( (ans[i+j]=='1') != c[j] ) f=0;
      |                                                        ^