제출 #762933

#제출 시각아이디문제언어결과실행 시간메모리
762933vjudge1Just Long Neckties (JOI20_ho_t1)C++17
9 / 100
1079 ms21076 KiB
#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 << " "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...