답안 #328909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
328909 2020-11-18T12:42:10 Z opukittpceno_hhr Gap (APIO16_gap) C++17
30 / 100
60 ms 2464 KB
#include "gap.h"

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

typedef long long ll;

const ll INF = 1e18 + 239;

ll findGap(int T, int N) {
    assert(T == 1);
    ll F, S;
    MinMax((ll)0, INF, &F, &S);
    vector<ll> v;
    while (F != -1 && F != S) {
        v.push_back(F);
        v.push_back(S);
        if ((int)v.size() == N) break;
        if (F + 1 > S - 1) break;
        ll nF, nS;
        MinMax(F + 1, S - 1, &nF, &nS);
        F = nF;
        S = nS;
    }
    if (F == S && F != -1) v.push_back(F);
    sort(v.begin(), v.end());
    assert((int)v.size() == N);
    ll ans = 0;
    for (int i = 0; i + 1 < N; i++) {
        ans = max(ans, v[i + 1] - v[i]);
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 12 ms 876 KB Output is correct
17 Correct 12 ms 876 KB Output is correct
18 Correct 14 ms 876 KB Output is correct
19 Correct 12 ms 876 KB Output is correct
20 Correct 10 ms 876 KB Output is correct
21 Correct 55 ms 2276 KB Output is correct
22 Correct 60 ms 2276 KB Output is correct
23 Correct 51 ms 2304 KB Output is correct
24 Correct 49 ms 2276 KB Output is correct
25 Correct 43 ms 2464 KB Output is correct
26 Correct 59 ms 2288 KB Output is correct
27 Correct 48 ms 2276 KB Output is correct
28 Correct 54 ms 2276 KB Output is correct
29 Correct 48 ms 2276 KB Output is correct
30 Correct 41 ms 2404 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
3 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
4 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
5 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
6 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
7 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
8 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
9 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
10 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
11 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
12 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
13 Runtime error 2 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
14 Runtime error 2 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
15 Runtime error 2 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
16 Runtime error 9 ms 876 KB Execution killed with signal 6 (could be triggered by violating memory limits)
17 Runtime error 7 ms 876 KB Execution killed with signal 6 (could be triggered by violating memory limits)
18 Runtime error 7 ms 876 KB Execution killed with signal 6 (could be triggered by violating memory limits)
19 Runtime error 7 ms 876 KB Execution killed with signal 6 (could be triggered by violating memory limits)
20 Runtime error 6 ms 936 KB Execution killed with signal 6 (could be triggered by violating memory limits)
21 Runtime error 30 ms 2028 KB Execution killed with signal 6 (could be triggered by violating memory limits)
22 Runtime error 24 ms 2028 KB Execution killed with signal 6 (could be triggered by violating memory limits)
23 Runtime error 23 ms 2028 KB Execution killed with signal 6 (could be triggered by violating memory limits)
24 Runtime error 24 ms 2156 KB Execution killed with signal 6 (could be triggered by violating memory limits)
25 Runtime error 20 ms 2156 KB Execution killed with signal 6 (could be triggered by violating memory limits)
26 Runtime error 24 ms 2232 KB Execution killed with signal 6 (could be triggered by violating memory limits)
27 Runtime error 25 ms 2284 KB Execution killed with signal 6 (could be triggered by violating memory limits)
28 Runtime error 24 ms 2204 KB Execution killed with signal 6 (could be triggered by violating memory limits)
29 Runtime error 23 ms 2028 KB Execution killed with signal 6 (could be triggered by violating memory limits)
30 Runtime error 16 ms 2268 KB Execution killed with signal 6 (could be triggered by violating memory limits)
31 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
32 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)