Submission #306557

#TimeUsernameProblemLanguageResultExecution timeMemory
306557peti1234Painting Squares (IOI20_squares)C++17
0 / 100
2 ms584 KiB
#include <bits/stdc++.h> #include "squares.h" using namespace std; const int c=512; int n; vector<int> sol, s, ans, sz[c]; bool v[c][2]; void dfs(int a) { if (!v[a][0]) { v[a][0]=1, dfs(sz[a][0]); s.push_back(0); } if (!v[a][1]) { v[a][1]=1, dfs(sz[a][1]); s.push_back(1); } } vector<int> paint(int N) { n=N; for (int i=0; i<n; i++) sz[i].clear(), sol.clear(), s.clear(), ans.clear(), v[i][0]=0, v[i][1]=0; for (int i=0; i<c; i++) { int x=2*i%c; sz[i].push_back(x), sz[i].push_back(x+1); } dfs(0); for (int i=0; i<9; i++) sol.push_back(0); while(s.size()>0) sol.push_back(s.back()), s.pop_back(); for (int i=0; i<n; i++) ans.push_back(sol[i]); ans.push_back(10); for (int i=0; i<10; i++) sol.push_back(-1); return ans; } int find_location(int k, vector<int> sz) { for (int i=0; i<n; i++) { bool jo=1; for (int j=0; j<k; j++) { if (sol[i+j]!=sz[j]) jo=0; } if (jo) return i; } }

Compilation message (stderr)

squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...