Submission #1316269

#TimeUsernameProblemLanguageResultExecution timeMemory
1316269nekoliePainting Squares (IOI20_squares)C++20
0 / 100
1 ms428 KiB
#include "squares.h" #include <bits/stdc++.h> using namespace std; const int k = 10; vector<int> paint(int n){ vector<int> paimon; if (n <= k) { for (int i = 0; i < n; i++) paimon.push_back(0); } else { for (int i = 0; i < k; i++) paimon.push_back(0); int cnt = 1; while (paimon.size() < n) { for (int i = 0; i < cnt && paimon.size() < n; i++) paimon.push_back(1); for (int i = 0; i < k-cnt-1 && paimon.size() < n; i++) paimon.push_back(0); cnt++; } } paimon.push_back(k); return paimon; } bool czy(vector<int> &a, vector<int> &b, int x) { for (int i = x; i < x+k; i++) if (a[i] != b[i]) return false; return true; } int find_location(int n, vector<int> c){ if (n <= k) { int cnt = 0; for (int i = 0; i < k; i++) if (c[i] != -1) cnt++; return n-cnt; } else { vector<int> oppai = paint(n); for (int i = 1; i < k; i++) oppai.push_back(-1); for (int i = 0; i < n; i++) if (czy(oppai,c,i)) return i; } }

Compilation message (stderr)

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