Submission #364389

#TimeUsernameProblemLanguageResultExecution timeMemory
364389arujbansalPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms384 KiB
#include <iostream> #include <random> #include <chrono> #include <algorithm> #include <utility> #include <set> #include <map> #include <queue> using namespace std; void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) #define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epock().count()) #define rng_seed(x) mt19937 rng(x) #define all(x) (x).begin(), (x).end() #define sz(x) (int) (x).size() // #define int long long const int MXN = 1e5 + 1, INF = 1e9 + 5; string solve_puzzle(string s, vector<int> c) { int N = sz(s), K = sz(c); deque<char> dq; for (int i = 0; i < K; i++) { for (int j = 0; j < c[i]; j++) dq.push_back('X'); if (i < K - 1) dq.push_back('_'); } while (sz(dq) < N) dq.push_back('_'); // for (const auto &x : dq) // cout << x; vector<int> cnt(N, 0); for (int iter = 0; iter < N; iter++) { for (int i = 0; i < sz(dq); i++) { if (dq[i] == 'X') cnt[i]++; } if (dq.back() != 'X') { dq.push_front('_'); dq.pop_back(); } } string ans; for (int i = 0; i < N; i++) { if (cnt[i] >= N) ans += 'X'; else if (cnt[i] > 0) ans += '?'; else ans += '_'; } return ans; } // void solve() { // cout << solve_puzzle(".........", vector<int>{1, 1, 1, 1, 1}); // } // signed main() { // ios_base::sync_with_stdio(false); // cin.tie(nullptr); // int TC = 1; // // cin >> TC; // while (TC--) solve(); // }
#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...