Submission #1010225

#TimeUsernameProblemLanguageResultExecution timeMemory
1010225c2zi6Paint By Numbers (IOI16_paint)C++14
32 / 100
1 ms348 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "paint.h" template<typename T> T rev(T s) { reverse(all(s)); return s; } VI apply(string s, VI c) { VI ret(s.size()); int p = 0; for (int i = 0; i < s.size(); i++) { int l = i; int r = i+c[p]-1; bool kareli = true; replr(i, l, r) if (s[i] != '.') { kareli = false; break; } if (kareli) { replr(i, l, r) ret[i] = p+1; i += c[p]; ++p; } } return ret; } string solve_puzzle(string s, VI c) { int n = s.size(); int k = c.size(); VI L = apply(s, c); VI R = rev(apply(rev(s), rev(c))); for (int& x : R) if (x) x = k+1-x; /*for (int x : L) cout << x; cout << endl;*/ /*for (int x : R) cout << x; cout << endl;*/ if (L == R) { string ans; rep(i, n) if (L[i]) ans.pb('X'); else ans.pb('_'); return ans; } string ans(n, '?'); rep(i, n) { if (L[i] == R[i] && L[i]) ans[i] = 'X'; } return ans; }

Compilation message (stderr)

paint.cpp: In function 'VI apply(std::string, VI)':
paint.cpp:43:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for (int i = 0; i < s.size(); i++) {
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...