제출 #596201

#제출 시각아이디문제언어결과실행 시간메모리
596201Ahmed57Paint By Numbers (IOI16_paint)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "paint.h" using namespace std; string solve_puzzle(string s,vector<int> c){ int ww[s.size()]={0},bb[s.size()]={0}; k = c.size(); int n = s.size(); for(int i = 0;i<(1<<n);i++){ int cnt = 0 , idx = 0; bool ss = 1; for(int j = 0;j<n;j++){ if(i&(1<<j)){ cnt++; }else{ if(cnt!=0){ if(idx>=k||c[idx]!=cnt){ ss = 0; break; } idx++; cnt = 0; } } } if(cnt!=0){ if(idx>=k||c[idx]!=cnt){ continue; } idx++; } if(ss&&idx==k){ for(int j = 0;j<n;j++){ if(i&(1<<j))ww[j] = 1; else bb[j] = 1; } } } string v; for(int i = 0;i<n;i++){ if(bb[i]&&ww[i])v+='?'; else if(bb[i])v+='_'; else v+='X'; } return v; } /* int main(){ string s;cin>>s; int k;cin>>k; int arr[k]; for(int i = 0;i<k;i++){ cin>>arr[i]; } cout<<solve_puzzle(s,k,arr); } */

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

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:8:5: error: 'k' was not declared in this scope
    8 |     k = c.size();
      |     ^