Submission #362206

#TimeUsernameProblemLanguageResultExecution timeMemory
362206knightron0Paint By Numbers (IOI16_paint)C++14
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; string solve_puzzle(string s, vector<int> c){ int n = s.length(); int tot = 0; int freq_empty[n+2]; clr(freq_empty, 0); int freq_used[n+2]; clr(freq_used, 0); for(int mask = 0;mask<(1<<n);mask++){ bool valid = true; vector<int> blocks; int curr = 0; for(int b=0;b<n;b++){ if(mask & (1<<b)){ if(s[b] == '_'){ valid = false; break; } else { curr++; continue; } } else { if(s[b] == 'X'){ valid = false; break; } else { if(curr!=0){ blocks.pb(curr); } curr = 0; } } } if(curr!=0){ blocks.pb(curr); } if(blocks.size() != c.size()) valid = false; if(!valid) continue; for(int i= 0;i<c.size();i++){ if(c[i] != blocks[i]) { valid = 0; break; } } if(valid){ tot++; for(int b=0;b<n;b++){ if(mask & (1<<b)){ freq_used[b]++; } else { freq_empty[b]++; } } } } string res = ""; for(int b=0;b<n;b++){ if(freq_empty[b] == tot){ res += "_"; } else if(freq_used[b] == tot){ res += "X"; } else { res += "?"; } } return res; }

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<long long int>)':
paint.cpp:58:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |   for(int i= 0;i<c.size();i++){
      |                ~^~~~~~~~~
/tmp/ccaEfk0d.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