Submission #381004

#TimeUsernameProblemLanguageResultExecution timeMemory
381004KarliverPaint By Numbers (IOI16_paint)C++14
0 / 100
2 ms492 KiB
#include "paint.h" #include <cstdlib> #include <bits/stdc++.h> #include <fstream> #define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x) #define all(v) (v).begin(), (v).end() using namespace std; #define forn(i,n) for (int i = 0; i < (n); ++i) using ll = long long; int mod = (ll)1e9 + 7; #define PI acos(-1) typedef pair<int, int> pairs; typedef complex<ll> G; const int INF = 1e9 + 1; const int N = 1e6; const double eps = 1e-3; std::string solve_puzzle(std::string s, std::vector<int> c) { int k = c.size(); int n = s.size(); int f = 0; bool bad = 0; for(int i = 0;i < n;) { int cnt = 0; int j = i; char pr = s[i]; if(s[i] == 'X' || s[i] == '.') { while(j < n && (s[j] == '.' || s[j] == 'X'))++j; while(f < k && j - i >= c[f]) { while(c[f]) { --c[f]; assert(i < n); s[i] = 'X'; ++i; } ++i; ++f; } i = j; } else { while(i < n && s[i] == '_')++i; } } forn(i, n)if(s[i] == '.')s[i] = '_'; }

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:24:13: warning: unused variable 'cnt' [-Wunused-variable]
   24 |         int cnt = 0;
      |             ^~~
paint.cpp:26:14: warning: unused variable 'pr' [-Wunused-variable]
   26 |         char pr = s[i];
      |              ^~
paint.cpp:22:10: warning: unused variable 'bad' [-Wunused-variable]
   22 |     bool bad = 0;
      |          ^~~
paint.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
#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...