Submission #930272

#TimeUsernameProblemLanguageResultExecution timeMemory
930272AiperiiiPaint By Numbers (IOI16_paint)C++14
10 / 100
133 ms600 KiB
#include <bits/stdc++.h> #include "paint.h" //#define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; string solve_puzzle(string s,vector<int> c) { int n=s.size(); string res=""; vector <int> cnt1(n),cnt2(n); for(int i=0;i<(1<<n);i++){ string x=s; for(int j=0;j<n;j++){ if((i&(1<<j))!=0)x[j]='X'; else x[j]='_'; } int cnt=0,ind=0; bool ok=1; for(int j=0;j<n;j++){ if(x[j]=='X')cnt++; else if(cnt!=0){ if(ind<c.size() && c[ind]==cnt)ind++; else ok=0; cnt=0; } } if(cnt!=0){ if(ind<c.size() && c[ind]==cnt)ind++; else ok=0; } if(ok && ind==c.size()){ for(int j=0;j<n;j++){ if(x[j]=='X')cnt1[j]++; else cnt2[j]++; } } } for(int i=0;i<n;i++){ if(cnt1[i] && cnt2[i])res+='?'; else if(cnt1[i])res+='X'; else res+='_'; } return res; } /*signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); string s; cin>>s; int n; cin>>n; vector <int> c(n); for(int i=0;i<n;i++){ cin>>c[i]; } cout<<solve_puzzle(s,c); } */

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:24:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |                 if(ind<c.size() && c[ind]==cnt)ind++;
      |                    ~~~^~~~~~~~~
paint.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(ind<c.size() && c[ind]==cnt)ind++;
      |                ~~~^~~~~~~~~
paint.cpp:33:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         if(ok && ind==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...