제출 #700870

#제출 시각아이디문제언어결과실행 시간메모리
700870Doncho_BonbonchoPaint By Numbers (IOI16_paint)C++14
32 / 100
1 ms316 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]; if( pref[c.size()-1] + c.size()-1 == s.size() ){ int ind = 0; std::string nas = ""; for( int i=0 ; i<c.size() ; i++ ){ for( int j=0 ; j<c[i] ; j++ ) nas += 'X'; if( i != c.size() -1 ) nas += '_'; } return nas; } /* 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:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for( int i=0 ; i<c.size() ; i++ ){
      |                  ~^~~~~~~~~
paint.cpp:26:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |    if( i != c.size() -1 ) nas += '_';
      |        ~~^~~~~~~~~~~~~~
paint.cpp:22:7: warning: unused variable 'ind' [-Wunused-variable]
   22 |   int ind = 0;
      |       ^~~
paint.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  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...