| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 300637 | whaleee | Handcrafted Gift (IOI20_gift) | C++14 | 1 ms | 512 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
#include "gift.h"
int construct(int n, int r, vi a, vi b, vi x) {
    string ans(n,'?');
    vpi one_color;
    vpi two_color;
    forn(i,r) {
        if (x[i] == 1) {
            one_color.pb(mp(a[i],b[i]));
        }
        else {
            two_color.pb(mp(a[i],b[i]));
        }
    }
    sort(all(one_color));
    sort(all(two_color));
    int i = 0;
    int color = 'R';
    while (i<one_color.size()) {
        int start = one_color[i].fi;
        int end = one_color[i].se;
        while (i+1<one_color.size() && one_color[i+1].fi <= end) {
            end = max(end,one_color[i+1].se);
            i++;
        }
        
        for (int j=start; j<=end; j++) {
            ans[j] = color;
        }
        if (color == 'R') {
            color = 'B';
        }
        else {
            color = 'R';
        }
        i++;
        
    }
    i = 0;
    bool ok = true;
    while (i<two_color.size()) {
        int start = two_color[i].fi;
        int end = two_color[i].se;
        
        while (i+1<two_color.size() && two_color[i+1].fi <= end) {
            end = max(end,two_color[i+1].se);
            i++;
        }
        int cnt_any = 0;
        int cnt_op1 = 0;
        int cnt_op2 = 0;
        vi to_fill;
        for (int j=start; j<=end; j++) {
            if (ans[j] == '?') {
                cnt_any++;
                to_fill.pb(j);
            }
            else if (ans[j] == 'R' ){
                cnt_op1++;
            }
            else {
                cnt_op2++;
            }
        }
        if (cnt_op1 > 0 && cnt_op2 > 0) {
            for (int pos: to_fill) {
                ans[pos] = 'R';  // any
            }
        }//ok}
        else if (cnt_any > 0 && cnt_op1 == 0) {
            for (int pos: to_fill) {
                ans[pos] = 'R';
            }
        }
        else if (cnt_any > 0 && cnt_op2 == 0) {
            for (int pos: to_fill) {
                ans[pos] = 'B';
            }
        }
        else if (cnt_op1 == end-start + 1 || cnt_op2 == end-start + 1) {
            ok = false;
            break;
        }
        else {
            // cout << "WTF?" << cnt_op1 << cnt_op2 << cnt_any;
        }
        i++;
    }
    if (ok) {
        craft(ans);
        return 1;
    }
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
