Submission #741354

#TimeUsernameProblemLanguageResultExecution timeMemory
741354josanneo22Painting Squares (IOI20_squares)C++17
0 / 100
1 ms304 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define pii pair<int,int> #define fi first #define se second vector<int> ans; void Init(){ int k = 10; for (int i = 0; i < 10; i++) ans.push_back(1); int v = (1 << k) - 1; vector<bool> kt(1 << k); kt[v] = true; while ((int)ans.size() < 1000) { v = (v << 1) % (1 << k); int sign = 0; if (kt[v]) { v++; sign = 1; } kt[v] = true; ans.push_back(sign); } } #include "squares.h" #include <vector> std::vector<int> paint(int n) { std::vector<int> labels(n + 1, 1); if(ans.empty()) Init(); ans[n]=10; for(int i=0;i<n;i++) labels[i]=ans[i]; return labels; } int find_location(int n, std::vector<int> c) { if(ans.empty()) Init(); vector<int> nw; for(int i=0;i<n;i++){ for(int j=0;j<10;j++){ if(i+j>n) nw.pb(-1); else nw.pb(ans[i+j]); } if(nw==c) return i; } }

Compilation message (stderr)

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