제출 #789650

#제출 시각아이디문제언어결과실행 시간메모리
789650AkramElOmraniPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms340 KiB
#pragma once #include <bits/stdc++.h> #include <string> #include <vector> using namespace std; std::string solve_puzzle(std::string s, std::vector<int> c) { int n = s.length(); int m = c.size(); string ans(n, '?'); int sm = accumulate(c.begin(), c.end(), 0) + c.size() - 1; if(sm == n) { int s = 0; for(int i = 0; i < m; ++i) { while(c[i]) { c[i]--; ans[s++] = 'X'; } if(s != n) ans[s++] = '_'; } // cout << ans << '\n'; return ans; } for(int i = 0; i < n; ++i) { int before = 0; int j = 0; while(j < m && before + c[j] <= i) { before += c[j++]; before++; } before = i + 1; while(j < m && before + c[j] <= n) { before += c[j++]; before++; } if(j != m) { ans[i] = 'X'; } } return ans; }

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

paint.cpp: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...