제출 #959043

#제출 시각아이디문제언어결과실행 시간메모리
959043IUA_HasinPaint By Numbers (IOI16_paint)C++17
7 / 100
1 ms500 KiB
#include <bits/stdc++.h> #define endl "\n" #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define ll long long using namespace std; #include "paint.h" #include <cstdlib> std::string solve_puzzle(std::string s, std::vector<int> c) { ll d = c.size(); ll arr[d]; ll brr[d]; vector<ll> v; for(int i=0; i<d; i++){ if(i==0){ arr[i] = c[i]; } else { arr[i] = arr[i-1]+c[i]+1; } } for(int i=d-1; i>=0; i--){ if(i==d-1){ brr[i] = c[i]; } else { brr[i] = brr[i+1]+c[i]+1; } } ll dd = s.length(); ll cnt = 0; ll a = arr[0]; ll b = brr[0]; for(int i=1; i<=dd; i++){ // cout<<a<<" "<<b<<endl; if(i<=a){ if(dd-b>=i){ v.push_back(i); } } else { a = arr[cnt+1]; b = brr[cnt+1]; cnt++; if(cnt>=d){ b = 0; a = arr[d-1]; } if(dd-b>=i){ v.push_back(i); } } } ll aaa = v.size(); // for(int i=0; i<d; i++){ // cout << arr[i] << " "; // } // cout<<endl; // for(int i=0; i<d; i++){ // cout << brr[i] << " "; // } // cout<<endl; // for(int i=0; i<v.size(); i++){ // cout << v[i] << " "; // } // cout<<endl; // ll dd = s.length(); string ss; if(aaa==d-1){ if(aaa==0){ for(int i=0; i<s.length(); i++){ ss.push_back('X'); } return ss; } else { ll cnt = 1; ll a = v[0]-1; for(int i=0; i<dd; i++){ if(cnt>aaa){ ss.push_back('X'); }else if(i==a){ ss.push_back('_'); a = v[cnt]-1; cnt++; } else { ss.push_back('X'); } } return ss; } }else if(v.size()==0){ for(int i=0; i<dd; i++){ ss.push_back('X'); } return ss; } else { ll cnt = 1; ll a = v[0]-1; for(int i=0; i<dd; i++){ if(cnt==aaa){ ss.push_back('?'); }else if(i==a){ ss.push_back('?'); a = v[cnt]-1; cnt++; } else { ss.push_back('X'); } } return ss; } }

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

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:81:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |             for(int i=0; i<s.length(); i++){
      |                          ~^~~~~~~~~~~
#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...