Submission #331477

#TimeUsernameProblemLanguageResultExecution timeMemory
331477NaynaPaint By Numbers (IOI16_paint)C++14
0 / 100
1 ms492 KiB
#include <bits/stdc++.h> #include "paint.h" #include <cstdlib> using namespace std; string solve_puzzle(string s, vector<int> c) { string ans; int k = c.size(); int n = s.size(); int cur = 0; for(int i = 0; i < n; i++) { if(s[i]!='.') continue; int cnt = 0, r = i; while(r < n && cnt<c[cur]) { if(s[r]=='_') break; cnt++; r++; } if(cnt==c[cur]) { for(int r = i; r < i+c[cur]; r++) s[r] = 'X'; s[i+c[cur]] = '_'; cur++; } } for(int i = 0; i < n; i++) { if(s[i]=='.') s[i] = '_'; } return s; }

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:10:9: warning: unused variable 'k' [-Wunused-variable]
   10 |     int k = c.size();
      |         ^
#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...