Submission #793390

#TimeUsernameProblemLanguageResultExecution timeMemory
793390SlavicGPainting Squares (IOI20_squares)C++17
0 / 100
92 ms620 KiB
#include "squares.h" #include <vector> #include <bits/stdc++.h> using namespace std; vector<int> generate(int n) { set<int> nums; vector<int> v(n); nums.insert((1 << 10) - 1); vector<int> a(1000, 0); for(int i = 0; i < 10; ++i) a[i] = 1; for(int i = 1; i + 10 - 1 < 1000; ++i) { int number = 0; for(int j = 0; j < 10; ++j) { if(a[i + j]) number += (1 << j); } if(nums.count(number)) { a[i + 10 - 1] = 1; } number = 0; for(int j = 0; j < 10; ++j) { if(a[i + j]) number += (1 << j); } assert(!nums.count(number)); nums.insert(number); } for(int i = 0; i < n; ++i) v[i] = a[i]; return v; } std::vector<int> paint(int n) { vector<int> labels = generate(n); labels.push_back(10); return labels; } int find_location(int n, std::vector<int> c) { return 0; vector<int> paiu = generate(n); int number = 0; for(int i = 0; i < (int)c.size(); ++i) { if(c[i] == -1) { return n - i; } if(c[i] == 1) number += (1 << i); } for(int i = 0; i + 10 - 1 < n; ++i) { int number2 = 0; for(int j = 0; j < 10; ++j) { if(paiu[i + j]) number2 += (1 << j); } if(number == number2) return i; } assert(false); return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...