Submission #362237

#TimeUsernameProblemLanguageResultExecution timeMemory
362237knightron0Paint By Numbers (IOI16_paint)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fr first #define sc second #define clr(a, x) memset(a, x, sizeof(a)) #define dbg(x) cout<<"("<<#x<<"): "<<x<<endl; #define printvector(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl; #define all(v) v.begin(), v.end() #define lcm(a, b) (a * b)/__gcd(a, b) #define int long long int #define printvecpairs(vec) for(auto it: vec) cout<<it.fr<<' '<<it.sc<<endl; #define endl '\n' #define float long double const int MOD = 1e9 + 7; const int INF = 2e15; const int MAXN = 1e5 + 5; bool check(int idx, vector<int> c, bool which, string s){ // which = 0, if checking empty // which = 1, if checking filled int n = s.length(); int k= c.size(); if(which){ int tot = 0; for(int i= 0;i<k;i++) tot += c[i]; bool valid = false; int curr = 0; for(int i= 0;i<k;i++){ for(int x = -1;x<=c[i];x++){ int z= x+1; int y = c[i]-z; if(idx-z >= 0 && idx +y < n){ int right = (n-(idx+y)-1); int left = max(idx-z-1, 0LL); int num = k-i; if(left >= (curr + max(0LL, i-1)) && right >= ((tot-curr-c[i])+(max(0LL,num-1)))){ valid = true; break; } } } if(valid){ break; } curr += c[i]; } return valid; } else { int tot = 0; int left = idx; int right = n-idx-1; for(int i= 0;i<k;i++) tot += c[i]; int curr = 0; bool valid = false; for(int i= 0;i<k;i++){ int num = k-i; if(left >= (curr + max(0LL, i-1)) && right >= (tot-curr+(max(0LL,num-1)))){ valid = true; break; } curr+= c[i]; } if(left >= (curr + max(0LL, k-1)) && right >= (tot-curr)){ valid = true; } return valid; } } string solve_puzzle(string s, vector<int> c){ int n = s.length(); string res = ""; for(int i= 0;i<n;i++){ bool empty = check(i, c, 0, s); bool fill = check(i, c, 1, s); if(empty && fill){ res += "?"; } else { if(empty){ res += "_"; } else { res += "X"; } } } return res; }

Compilation message (stderr)

/tmp/ccrDyWB0.o: In function `main':
grader.cpp:(.text.startup+0x239): undefined reference to `solve_puzzle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status