Submission #892257

# Submission time Handle Problem Language Result Execution time Memory
892257 2023-12-25T06:11:42 Z vjudge1 Team Contest (JOI22_team) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_multiset tree<type1, null_type, less_equal<type1>, rb_tree_tag, tree_order_statistics_node_update>;
 
using namespace std;
using namespace __gnu_pbds;
 
const int mod = 998244353;
const double PI = acos(-1.0);
const double epsilon = 1e-6;
const int N = 2e5+5;
 
void solve(){
	int n; cin >> n;
	vector<pair<int,int> > a(n),b(n),c(n);
	for(int i = 0; i < n; i++){
		cin >> a[i].ff >> b[i].ff >> c[i].ff;
		a[i].ss = i; b[i].ss = i; c[i].ss = i;
	}
	sort(rall(a)); sort(rall(b)); sort(rall(c));
	
	vector<int> posc(n),posb(n),posa(n);
	int ita = a[0].ff,itb = b[0].ff,itc = c[0].ff,sta = 0,stb = 0,stc = 0;
	for(int i = 0; i < n; i++){
		posa[a[i].ss] = i - sta;
		posb[b[i].ss] = i - stb;
		posc[c[i].ss] = i - stc;
		if(a[i].ff == ita) sta++;
		else sta = 1,ita = a[i].ff;
		if(b[i].ff == itb) stb++;
		else stb = 1,itb = b[i].ff;
		if(c[i].ff == itc) stc++;
		else stc = 1,itc = c[i].ff;
	}
	
	int ans = -1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < n; k++){
				if(a[i].ss != b[j].ss && a[i].ss != c[k].ss && b[j].ss != c[k].ss &&
				   posa[c[k].ss] > posa[a[i].ss] && posa[c[k].ss] > posa[b[j].ss] &&
				   posb[c[k].ss] > posb[b[j].ss]) ans = max(ans, a[i].ff + b[j].ff + c[k].ff);
			}
		}
	}
	cout << ans;
}
 
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
}

Compilation message

team.cpp:58:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   58 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -