제출 #310756

#제출 시각아이디문제언어결과실행 시간메모리
310756whaleeePainting Squares (IOI20_squares)C++14
0 / 100
577 ms844 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(20000,0); vi paint(int n) { forn(i,labels_global.size()) { labels_global[i] = -1; } vi labels(n + 1, 1); int k = 0; while ((pow(2,k)-1)+k < n) { k++; } forn(i,k) { labels_global[i] = 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 < n) { val = (val << 1) % (int)pow(2,k); sym = 0; if (visited[val]) { val += 1; sym = 1; } visited[val] = true; labels[i+k] = sym; labels_global[i+k] = sym; i++; } labels[n] = k; return labels; } int find_location(int n, vi c) { 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...