제출 #1010768

#제출 시각아이디문제언어결과실행 시간메모리
1010768c2zi6Paint 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; } bool azat(string& s, int l, int r) { if (r >= s.size()) return false; replr(i, l, r) if (s[i] != '.') return false; return true; } VI apply(string s, VI c, bool rv = false) { if (rv) { reverse(all(s)); reverse(all(c)); } VI ret; int p = 0; for (int i = 0; i < s.size(); i++) { int l = i; int r = i+c[p]-1; if (azat(s, l, r)) { if (rv) ret.pb(s.size()-i-c[p]); else ret.pb(i); i += c[p]; if (++p == c.size()) break; } } if (rv) reverse(all(ret)); return ret; } string solve_puzzle(string s, VI c) { int n = s.size(); int k = c.size(); VI L = apply(s, c); VI R = apply(s, c, true); /*for (int& x : R) x = n-x;*/ /*for (int x : L) cout << x+1 << " "; cout << endl;*/ /*for (int x : R) cout << x+1 << " "; cout << endl;*/ string ans; if (L == R) ans = string(n, '_'); else ans = string(n, '?'); rep(i, k) { replr(j, R[i], L[i]+c[i]-1) ans[j] = 'X'; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'bool azat(std::string&, int, int)':
paint.cpp:41:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     if (r >= s.size()) return false;
      |         ~~^~~~~~~~~~~
paint.cpp: In function 'VI apply(std::string, VI, bool)':
paint.cpp:53:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for (int i = 0; i < s.size(); i++) {
      |                     ~~^~~~~~~~~~
paint.cpp:60:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |             if (++p == c.size()) break;
      |                 ~~~~^~~~~~~~~~~
#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...