#include "squares.h"
#include <bits/stdc++.h>
using namespace std;
const int k = 100;
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;
return 67;
}
}
/*
int main() {
int n; cin >> n;
vector<int> pp = paint(n);
for (int i = 0; i < n; i++)
cout << pp[i] << " ";
cout << endl;
return 0;
}
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |