Submission #372207

#TimeUsernameProblemLanguageResultExecution timeMemory
372207cpp219Painting Squares (IOI20_squares)C++14
Compilation error
0 ms0 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> #define ll int #define ld long double #define fs first #define sc second using namespace std; typedef pair<ll,ll> LL; const ll N = 2e3 + 9; const ll mod = 1e9 + 7; vector<ll> g[N]; deque<ll> ans; ll b[N],pow2[N],p1,p2,n; void process(){ p1 = p2 = 0; for (ll i = 0;i < 9;i++) p1 += pow2[9 - i - 1]*b[i]; for (ll i = 1;i <= 9;i++) p2 += pow2[9 - i]*b[i]; g[p1].push_back(p2); } void f(ll i){ if (i > 9){ process(); return; } b[i] = 1; f(i + 1); b[i] = 0; f(i + 1); } void dfs(ll u){ while(g[u].size()){ ll v = g[u].back(); g[u].pop_back(); dfs(v); } ans.push_back(u%2); } deque<ll> paint(ll n){ pow2[0] = 1; for (ll i = 1;i <= 10;i++) pow2[i] = pow2[i - 1]*2; f(0); //for (auto i : g[0]) cout<<i<< " "; dfs(0); reverse(ans.begin(),ans.end()); for (ll i = 0;i < 8;i++) ans.push_front(0); while(ans.size() > n) ans.pop_back(); ans.push_back(10); return ans; } bool coincide(deque<ll> &c,ll l,ll r){ for (ll i = l;i <= r;i++) if (c[i - l] != ans[i]) return 0; return 1; } ll find_location(ll n,deque<ll> &c){ for (ll i = 0;i < 10;i++) if (c[i] == -1) return n - i; for (ll i = 0;i < n - 10 + 1;i++){ if (coincide(c,i,i + 10 - 1)) return i; } } /* int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "tst" if (fopen(task".INP","r")){ freopen(task".INP","r",stdin); //freopen(task".OUT","w",stdout); } } */

Compilation message (stderr)

squares.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
squares.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      | 
squares.cpp: In function 'std::deque<int> paint(int)':
squares.cpp:44:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   44 |     for (ll i = 1;i <= 10;i++) pow2[i] = pow2[i - 1]*2; f(0);
      |     ^~~
squares.cpp:44:57: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   44 |     for (ll i = 1;i <= 10;i++) pow2[i] = pow2[i - 1]*2; f(0);
      |                                                         ^
squares.cpp:48:22: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |     while(ans.size() > n) ans.pop_back(); ans.push_back(10);
      |           ~~~~~~~~~~~^~~
squares.cpp:48:5: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   48 |     while(ans.size() > n) ans.pop_back(); ans.push_back(10);
      |     ^~~~~
squares.cpp:48:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   48 |     while(ans.size() > n) ans.pop_back(); ans.push_back(10);
      |                                           ^~~
squares.cpp: In function 'int find_location(int, std::deque<int>&)':
squares.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
/usr/bin/ld: /tmp/ccU4yYvT.o: in function `main':
stub.cpp:(.text.startup+0x420): undefined reference to `find_location(int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status