Submission #741362

#TimeUsernameProblemLanguageResultExecution timeMemory
741362josanneo22Painting Squares (IOI20_squares)C++17
0 / 100
1 ms208 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 #include "squares.h" #include <vector> vector<int> Init(){ vector<int> ans; 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); } return ans; } vector<int> paint(int n) { vector<int> labels=Init(); labels.pb(10); return labels; } int find_location(int n, vector<int> c) { vector<int> ans=Init(); for(int i=0;i<n;i++){ vector<int> nw; 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+1; } }

Compilation message (stderr)

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