Submission #965307

#TimeUsernameProblemLanguageResultExecution timeMemory
965307AdamGSPainting Squares (IOI20_squares)C++17
0 / 100
99 ms932 KiB
#include "squares.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() int akt[1<<9]; vector<int>S; void DFS(int x) { while(akt[x]<2) { int p=akt[x]; ++akt[x]; DFS((2*x+p)%(1<<9)); S.pb(p); } } void generuj() { S.clear(); rep(i, 1<<9) akt[i]=0; DFS(0); rep(i, 9) S.pb(0); } vector<int>paint(int n) { generuj(); while(S.size()>n) S.pop_back(); S.pb(10); return S; } int find_location(int n, vector<int>T) { rep(i, T.size()) if(T[i]==-1) return n-i; generuj(); rep(i, S.size()) { bool ok=true; rep(j, T.size()) if(S[i+j]!=T[j]) { ok=false; break; } return i; } return 0; }

Compilation message (stderr)

squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:27:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   while(S.size()>n) S.pop_back();
      |         ~~~~~~~~^~
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
squares.cpp:32:3: note: in expansion of macro 'rep'
   32 |   rep(i, T.size()) if(T[i]==-1) return n-i;
      |   ^~~
squares.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
squares.cpp:34:3: note: in expansion of macro 'rep'
   34 |   rep(i, S.size()) {
      |   ^~~
squares.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
squares.cpp:36:5: note: in expansion of macro 'rep'
   36 |     rep(j, T.size()) if(S[i+j]!=T[j]) {
      |     ^~~
squares.cpp:35:10: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
   35 |     bool ok=true;
      |          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...