제출 #1167532

#제출 시각아이디문제언어결과실행 시간메모리
1167532SmuggingSpunPaint By Numbers (IOI16_paint)C++20
10 / 100
2095 ms424 KiB
#include<bits/stdc++.h> #include "paint.h" using namespace std; string solve_puzzle(string s, vector<int>c) { for(char& c : s){ if(c != '.'){ c = (c == 'X' ? '1' : '0'); } } int n = s.size(); if(n <= 20){ vector<int>ans(n, 0); for(int mask = (1 << n) - 1; mask > -1; mask--){ string cur = ""; vector<int>C; bool flag = true; for(int i = 0; i < n; i++){ cur += char((mask >> i & 1) + 48); if(s[i] != '.' && cur.back() != s[i]){ flag = false; break; } } if(flag){ cur += '0'; for(int i = 0, cnt = 0; i <= n; i++){ if(cur[i] == '0' && cnt > 0){ C.emplace_back(cnt); cnt = 0; } else if(cur[i] == '1'){ cnt++; } } if(C == c){ for(int i = 0; i < n; i++){ ans[i] |= 1 << (cur[i] - 48); } } } } string ret = ""; for(int i = 0; i < n; i++){ ret += (ans[i] == 1 ? '_' : (ans[i] == 2 ? 'X' : '?')); } return ret; } }

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

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
paint.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
paint_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...