제출 #587552

#제출 시각아이디문제언어결과실행 시간메모리
587552Red_InsideTeam Contest (JOI22_team)C++17
0 / 100
1 ms340 KiB
// #include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mp make_pair #define o cout<<"BUG"<<endl; #define FOR(i, j, n) for(int j = i; j < n; ++j) #define forn(i, j, n) for(int j = i; j <= n; ++j) #define nfor(i, j, n) for(int j = n; j >= i; --j) #define sortv(vv) sort(vv.begin(), vv.end()) #define all(v) v.begin(), v.end() #define ld long double #define ull unsigned long long using namespace std; const int maxn=3e5+10,LOG=17, mod=1e9+7; int block = 320, timer = 0; const ld EPS = 1e-18; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define bt(i) (1 << (i)) #define int ll const int inf=2e18; #define y1 yy #define prev pre #define pii pair <int, int> int n, a[maxn], b[maxn], c[maxn], ind[maxn], pref[maxn], mnc[maxn]; bool cmp(int i, int j) { if(a[i] == a[j]) { if(b[i] == b[j]) return c[i] < c[j]; else return b[i] < b[j]; } else return a[i] < a[j]; } void add(int i) { int A = a[i]; int B = b[i]; int C = c[i]; forn(B, i, 4000) { pref[i] = max(pref[i], C); } mnc[B] = min(mnc[B], C); } int check(int A, int B, int C) { int ret = -inf; forn(B + 1, i, 4000) { if(pref[i - 1] > max(C, mnc[i])) { ret = max(ret, pref[i - 1] + A + i); } } return ret; } main() { IOS cin >> n; forn(1, i, n) { cin >> a[i] >> b[i] >> c[i]; ind[i] = i; } forn(1, i, 4000) mnc[i] = inf; forn(1, i, 4000) pref[i] = -inf; sort(ind + 1, ind + 1 + n, cmp); int ans = -inf; forn(1, i, n) { int j = i; while(a[ind[j+1]] == a[ind[i]]) { ans = max(ans, check(a[ind[j]], b[ind[j]], c[ind[j]])); ++j; } ans = max(ans, check(a[ind[j]], b[ind[j]], c[ind[j]])); forn(i, k, j) { add(ind[k]); } i = j; } cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

team.cpp: In function 'void add(long long int)':
team.cpp:46:6: warning: unused variable 'A' [-Wunused-variable]
   46 |  int A = a[i];
      |      ^
team.cpp: At global scope:
team.cpp:69:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   69 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...