제출 #700867

#제출 시각아이디문제언어결과실행 시간메모리
700867Doncho_BonbonchoPaint By Numbers (IOI16_paint)C++14
7 / 100
1 ms340 KiB
#include "paint.h" #include <bits/stdc++.h> #include <cstdlib> int pref[128]; std::string nas = ""; void f( int l, int r, int n ){ int size = r - l + 1; // std::cerr<<" ! "<<size<<" "<<n<<"\n"; for( int i=0 ; i < size - n ; i++ ) nas[l+i] = nas[r-i] = '?'; } std::string solve_puzzle(std::string s, std::vector<int> c) { for( int i=0 ; i<s.size() ; i++ ) nas += 'X'; for( int i=0 ; i<c.size() ; i++ ) pref[i] = ( i ? pref[i-1] : 0 ) + c[i]; /* std::cerr<<"\n"; for( int i=0 ; i<c.size() ; i++ ) std::cerr<<pref[i]<<"\n"; std::cerr<<"\n"; */ for( int i=0 ; i <c.size() ; i++ ){ int l = ( i ? pref[i-1] + i : 0 ); int r = s.size() - ( pref[c.size()-1]-pref[i] + c.size() - i -1 )-1; // std::cerr<<s.size()<<" - ( "<<pref[c.size()-1]<<" - "<<pref[i]<<" + "<<c.size()<<" - "<<i<<" - "<<1<<")\n"; // std::cerr<<l<<" "<<r<<" , "<<c[i]<<"\n"; f( l, r, c[i] ); } return nas; }

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

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