답안 #762933

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762933 2023-06-22T01:30:05 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
1000 ms 21076 KB
#ifdef MINHDEPTRAI

#include "/Library/Developer/CommandLineTools/usr/include/c++/v1/bits/stdc++.h"  
#include <chrono>
#define __gcd(a, b) gcd(a, b)
using namespace std ::chrono;
#else 
#include <bits/stdc++.h>
#endif

using namespace std;
#define foru(i, a, b) for(int i = a; i <= b; ++i)
#define ford(i, a, b) for(int i = a; i >= b; --i)
#define IOS ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp(a, b) make_pair(a, b)
#define endl '\n'

#define int long long
const int maxN = 1e6+ 5;
const int mod = 998244353;
const long long inf = 1e17;
int n, arr[maxN], b[maxN];
set<int> number, number_two;
bool used[maxN];
signed main(){
    // freopen("input.txt", "r", stdin);
    // freopen("output2.txt", "w", stdout);
    // input
    IOS
    cin >> n;
    foru(i, 1, n + 1) {
        cin >> arr[i];
        number.insert(arr[i]);

    }

    foru(i, 1, n){
        cin >> b[i];
        number_two.insert(b[i]);
    }
    foru(i, 1, n + 1){

        int pre = arr[i];
        number.erase(number.find(pre));
        int sum = 0;
        set<int>:: iterator it = number.begin(), it_two = number_two.begin();


        while(it != number.end()){
            int val = *it - *it_two;
            //cout << val << " check " << i << endl;
            sum = max(sum, max(val, 0ll));
            
            it_two++;
            it++;
        }
        
        number.insert(pre);
        cout << sum << " ";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 7 ms 448 KB Output is correct
15 Correct 23 ms 504 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 36 ms 548 KB Output is correct
18 Correct 25 ms 516 KB Output is correct
19 Correct 32 ms 724 KB Output is correct
20 Correct 26 ms 532 KB Output is correct
21 Correct 28 ms 536 KB Output is correct
22 Correct 26 ms 520 KB Output is correct
23 Correct 26 ms 516 KB Output is correct
24 Correct 28 ms 528 KB Output is correct
25 Correct 41 ms 560 KB Output is correct
26 Correct 37 ms 552 KB Output is correct
27 Correct 36 ms 540 KB Output is correct
28 Correct 41 ms 552 KB Output is correct
29 Correct 28 ms 468 KB Output is correct
30 Correct 35 ms 544 KB Output is correct
31 Correct 41 ms 468 KB Output is correct
32 Correct 51 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 7 ms 448 KB Output is correct
15 Correct 23 ms 504 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 36 ms 548 KB Output is correct
18 Correct 25 ms 516 KB Output is correct
19 Correct 32 ms 724 KB Output is correct
20 Correct 26 ms 532 KB Output is correct
21 Correct 28 ms 536 KB Output is correct
22 Correct 26 ms 520 KB Output is correct
23 Correct 26 ms 516 KB Output is correct
24 Correct 28 ms 528 KB Output is correct
25 Correct 41 ms 560 KB Output is correct
26 Correct 37 ms 552 KB Output is correct
27 Correct 36 ms 540 KB Output is correct
28 Correct 41 ms 552 KB Output is correct
29 Correct 28 ms 468 KB Output is correct
30 Correct 35 ms 544 KB Output is correct
31 Correct 41 ms 468 KB Output is correct
32 Correct 51 ms 540 KB Output is correct
33 Execution timed out 1079 ms 21076 KB Time limit exceeded
34 Halted 0 ms 0 KB -