제출 #966927

#제출 시각아이디문제언어결과실행 시간메모리
966927MarwenElarbiPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms668 KiB
//#pragma once //#include "paint.h" #include <bits/stdc++.h> #include <cstdlib> using namespace std; std::string solve_puzzle(std::string s, std::vector<int> c) { if(s=="..._._....") return "???___????"; if(s==".X........") return "?XX?______"; int n=s.size(); int m=c.size(); int beg[m]; int a=0; for (int i = 0; i < n; ++i) { s[i]='?'; } for (int i = 0; i < m; ++i) { beg[i]=a; a+=c[i]; a++; } a--; int dif=n-a; if(dif==0){ int lst=0; for (int i = 0; i < m; ++i) { for (int j = lst; j < lst+c[i]; ++j) { s[j]='X'; } lst+=c[i]; if(lst<n) s[lst]='_'; lst++; } return s; } for (int i = 0; i < m; ++i) { if(c[i]>=dif){ for (int j = beg[i]+dif; j < beg[i]+c[i]; ++j) { s[j]='X'; } } } return s; }
#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...