제출 #310864

#제출 시각아이디문제언어결과실행 시간메모리
310864whaleeePainting Squares (IOI20_squares)C++14
100 / 100
167 ms540 KiB
#include <bits/stdc++.h> #include "squares.h" #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long i64; typedef vector<i64> vi64; typedef vector<vi64> vvi64; typedef pair<i64, i64> pi64; typedef double ld; vi labels_global; void create_array() { int k = 10; forn(i,k) { labels_global.pb(1); } vector<bool>visited(pow(2,k)+1, 0); int val = pow(2,k)-1; int sym; visited[val] = true; int i = 0 ; while (i+k < 1030) { val = (val << 1) % (int)pow(2,k); sym = 0; if (visited[val]) { val += 1; sym = 1; } visited[val] = true; labels_global.pb(sym); i++; } } vi paint(int n) { if (labels_global.empty()) { create_array(); } vi labels(n + 1, 1); forn(i, n) { labels[i] = labels_global[i]; } labels[n] = 10; return labels; } int find_location(int n, vi c) { if (labels_global.empty()) { create_array(); } if (c.back() == -1) { int ans = n-c.size(); ford(i,c.size()) { if (c[i] == -1) { ans++; } else { return ans; } } } return search(begin(labels_global), end(labels_global), begin(c), end(c)) - labels_global.begin(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...