답안 #381004

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381004 2021-03-24T07:39:41 Z Karliver Paint By Numbers (IOI16_paint) C++14
0 / 100
2 ms 492 KB
#include "paint.h"

#include <cstdlib>
#include <bits/stdc++.h>
#include <fstream>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace  std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
int mod = (ll)1e9 + 7;
#define PI acos(-1)
typedef pair<int, int> pairs;
typedef complex<ll> G;
const int INF = 1e9 + 1;
const int N = 1e6;
const double eps = 1e-3;
std::string solve_puzzle(std::string s, std::vector<int> c) {
    int k = c.size();
    int n = s.size();
    int f = 0;
    bool bad = 0;
    for(int i = 0;i < n;) {
        int cnt = 0;
        int j = i;
        char pr = s[i];
        if(s[i] == 'X' || s[i] == '.') {
            while(j < n && (s[j] == '.' || s[j] == 'X'))++j;
            while(f < k && j - i >= c[f]) {
                while(c[f]) {
                    --c[f];
                    assert(i < n);
                    s[i] = 'X';
                    ++i;
                }
                ++i;
                ++f;
            }
            i = j;
        }
        else {
            while(i < n && s[i] == '_')++i;
        }
    }

    forn(i, n)if(s[i] == '.')s[i] = '_';

}

Compilation message

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:24:13: warning: unused variable 'cnt' [-Wunused-variable]
   24 |         int cnt = 0;
      |             ^~~
paint.cpp:26:14: warning: unused variable 'pr' [-Wunused-variable]
   26 |         char pr = s[i];
      |              ^~
paint.cpp:22:10: warning: unused variable 'bad' [-Wunused-variable]
   22 |     bool bad = 0;
      |          ^~~
paint.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -