Submission #1223806

#TimeUsernameProblemLanguageResultExecution timeMemory
1223806viduxPaint By Numbers (IOI16_paint)C++17
32 / 100
0 ms328 KiB
#include "paint.h" #include <bits/stdc++.h> #define fi first #define se second #define ALL(x) (x.begin()), (x.end()) #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_ARR(x) cerr << #x << ": "; for (auto &y : x) cout << y << " "; cout << endl; #define SZ(x) ((int)x.size()) using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; std::string solve_puzzle(std::string s, std::vector<int> c) { int n = SZ(s); int k = SZ(c); vi w(n), b(n); int pref = 0; int extra = n-accumulate(ALL(c), 0)-k+1; for (int i = 0; i < k; i++) { for (int j = pref; j < c[i]+pref+extra; j++) { b[j] = 1; } for (int j = 0; j < extra; j++) { w[pref+j] = 1; w[c[i]+pref+extra-1-j] = 1; } if (pref-1 >= 0) w[pref-1] = 1; if (c[i]+pref+extra < n) w[c[i]+pref+extra] = 1; pref += 1+c[i]; } string ans(n, '?'); for (int i = 0; i < n; i++) { if (w[i] && !b[i]) ans[i] = '_'; if (!w[i] && b[i]) ans[i] = 'X'; } return ans; }

Compilation message (stderr)

paint.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
paint_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...