제출 #131911

#제출 시각아이디문제언어결과실행 시간메모리
131911MasterdanPaint By Numbers (IOI16_paint)C++14
32 / 100
2 ms424 KiB
#include "paint.h" #include <bits/stdc++.h> #define MIN -1 #define MAX 1000000000 #define all(a) a.begin (), a.end () #define pb push_back #define mp make-pair using namespace std; typedef vector <int> vi; typedef long long int ll; typedef pair <int, int> ii; string solve_puzzle(string s, vector<int> c) { string res; int n=s.size (); int k=c.size (); vector <int> v1; for(int i=0;i<k;i++){ //if(c1==k)break; int t=i; for(int j=0;j<c[i];j++){ res+='X'; } v1.pb(res.size ()); if(res.size()==n)break; res+='_'; } int s1=1; //cout<<res<<endl; if(res[res.size ()-1]!='_'){ return res; }else{ for(int i=res.size ();i<n;i++){res+='_';s1++;} } int aux[n+1]; //cout<<res<<endl; int j=0; string gg; gg.resize(res.size ()); /*for(int i=0;i<v1.size ();i++)cout<<v1[i]<<" "; cout<<endl;*/ for(int i=0;i<res.size();i++){ if(res[i]=='X'){ if(v1[j]-1>=i+s1){ if(res[i+s1]=='X'){ gg[i+s1]='X'; } } if(i==v1[j]-1){ j++; } } //cout<<res<<endl; } /*for(int i=0;i<n;i++)cout<<aux[i]<<" "; cout<<endl;*/ for(int i=0;i<gg.size ();i++){ if(gg[i]!='X')gg[i]='?'; if(s[i]=='_')gg[i]='_'; } return gg; } /* const int S_MAX_LEN = 200 * 1000; char buf[S_MAX_LEN + 1]; int main() { assert(1 == scanf("%s", buf)); std::string s = buf; int c_len; assert(1 == scanf("%d", &c_len)); std::vector<int> c(c_len); for (int i = 0; i < c_len; i++) { assert(1 == scanf("%d", &c[i])); } std::string ans = solve_puzzle(s, c); printf("%s\n", ans.data()); return 0; } */

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:24:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(res.size()==n)break;
            ~~~~~~~~~~^~~
paint.cpp:19:9: warning: unused variable 't' [-Wunused-variable]
     int t=i;
         ^
paint.cpp:41:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<res.size();i++){
                 ~^~~~~~~~~~~
paint.cpp:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<gg.size ();i++){
                 ~^~~~~~~~~~~
paint.cpp:34:9: warning: unused variable 'aux' [-Wunused-variable]
     int aux[n+1];
         ^~~
#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...