Submission #1244989

#TimeUsernameProblemLanguageResultExecution timeMemory
1244989chinesegenius69420Paint By Numbers (IOI16_paint)C++20
32 / 100
0 ms328 KiB
#include <bits/stdc++.h> #include "paint.h" #define dbg(x) cerr << #x << ": " << x << '\n'; using namespace std; string solve_puzzle(string s, vector<int> c) { int n = s.size(); int csi = c.size(); vector<int> arr(n, 0), pref(csi + 1, 0); string ans; ans.resize(n, '?'); for(int i = 0; i < csi; i++){ pref[i + 1] = pref[i] + c[i]; } for(int z = 0; z < (int)c.size(); z++){ int a = n - (pref[csi] - pref[z + 1] + csi - z - 1); for(int i = pref[z] + z; i <= a - c[z]; i++){ for(int j = 0; j < c[z]; j++){ arr[i + j]++; } } int nose = a - c[z] - pref[z] - z + 1; for(int i = pref[z] + z; i <= n; i++){ if(arr[i] == nose){ ans[i] = 'X'; } } if(z != c.size() - 1 and s.size() == pref[csi] + csi - 1){ ans[pref[z + 1] + z] = '_'; } arr.resize(n, 0); } 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...