Submission #1169177

#TimeUsernameProblemLanguageResultExecution timeMemory
1169177Zbyszek99Painting Squares (IOI20_squares)C++20
100 / 100
312 ms420 KiB
#include "squares.h" #include <bits/stdc++.h> #define ll long long #define ld long double #define ff first #define ss second #define vi vector<int> #define vl vector<long long> #define pii pair<int,int> #define pll pair<long long, long long> #define pb push_back #define rep(i, b) for(int i = 0; i < (b); ++i) #define rep2(i,a,b) for(int i = a; i <= (b); ++i) #define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c) #define count_bits(x) __builtin_popcountll((x)) #define all(x) (x).begin(),(x).end() #define siz(x) (int)(x).size() #define forall(it,x) for(auto& it:(x)) using namespace std; //mt19937 mt;void random(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());} //ll rand(ll a, ll b) {return a + (mt() % (b-a+1));} const int INF = 1e9+50; const ll INF_L = 1e18+40; const ll MOD = 1e9+7; string ans = "1111111111000000000100000000110000000101000000011100000010010000001011000000110100000011110000010001000001001100000101010000010111000001100100000110110000011101000001111100001000010001100001001010000100111000010100100001010110000101101000010111100001100010000110011000011010100001101110000111001000011101100001111010000111111000100010100010001110001001001000100101100010011010001001111000101001100010101010001010111000101100100010110110001011101000101111100011000110010100011001110001101001000110101100011011010001101111000111001100011101010001110111000111100100011110110001111101000111111100100100110010010101001001011100100110110010011101001001111100101001010011100101010110010101101001010111100101100110010110101001011011100101110110010111101001011111100110011010011001111001101010100110101110011011011001101110100110111110011100111010110011101101001110111100111101010011110111001111101100111111010011111111010101010111010101101101010111110101101011011110101110111010111101101011111110110110111011"; vi paint(int n) { vi a(n+1); rep(i,n) if(ans[i] == '0') a[i] = 0; else a[i] = 1; a[n] = 10; return a; } int find_location(int n, vi c) { if(c.back() == -1) { int ile = 0; forall(it,c) if(it == -1) ile++; return n - (10-ile); } string p; rep(i,10) { if(c[i] == 0) p += "0"; else p += '1'; } string p2; rep(i,n) { p2 = ""; rep2(j,i,i+10-1) { if(ans[j] == '0') p2 += "0"; else p2 += "1"; } if(p == p2) return i; } }

Compilation message (stderr)

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