Submission #697706

# Submission time Handle Problem Language Result Execution time Memory
697706 2023-02-10T20:17:45 Z tvladm2009 Handcrafted Gift (IOI20_gift) C++17
0 / 100
142 ms 22616 KB
#include <bits/stdc++.h>
#include "gift.h"

using namespace std;

typedef long long ll;

const int N_MAX = 500000;

int mars[N_MAX + 2], ok[N_MAX + 2];

int construct(int n, int r, vector <int> a, vector <int> b, vector <int> x) {
    for (int i = 0; i < r; i++) {
        a[i]++;
        b[i]++;
        if (a[i] == b[i] && x[i] == 1) {
            return 0;
        }
    }
    for (int i = 0; i < r; i++) {
        if (x[i] == 1) {
            mars[a[i]]++;
            mars[b[i] + 1]--;
        }
    }
    for (int i = 1; i <= n; i++) {
        mars[i] += mars[i - 1];
        if (mars[i] != 0) {
            ok[i] = ok[i - 1] + 1;
        }
    }
    for (int i = 0; i < r; i++) {
        if (x[i] == 1) {
            continue;
        }
        if (ok[b[i]] - ok[a[i] - 1] == b[i] - a[i] + 1) {
            return 0;
        }
    }
    string s = "R";
    for (int i = 1; i < n; i++) {
        if (ok[i + 1] <= 1) {
            if (s[i - 1] == 'R') {
                s += 'B';
            } else {
                s += 'R';
            }
        } else {
            s += s[i - 1];
        }
    }
    craft(s);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Possible does not match answer file
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 708 KB Output is correct
4 Correct 142 ms 20952 KB Output is correct
5 Correct 142 ms 20940 KB Output is correct
6 Incorrect 135 ms 22616 KB Possible does not match answer file
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Possible does not match answer file
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Possible does not match answer file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Possible does not match answer file
3 Halted 0 ms 0 KB -