제출 #697105

#제출 시각아이디문제언어결과실행 시간메모리
697105penguin133Team Contest (JOI22_team)C++17
100 / 100
108 ms14836 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, A[150005], B[150005], C[150005];
vector <pi> v, v2, v3;
vector <pii> lmao;
void solve(){
	cin >> n;
	for(int i=1;i<=n;i++)cin >> A[i] >> B[i] >> C[i], v.push_back({A[i], i}), v2.push_back({B[i], i}), v3.push_back({C[i], i});
	sort(v.begin(), v.end());
	sort(v2.begin(), v2.end());
	sort(v3.begin(), v3.end());
	int x = n - 1, y = n - 1, z = n - 1;
	while(x >= 0 && y >= 0 && z >= 0){
		int a = v[x].se, b = v2[y].se, c = v3[z].se;
		if((A[a] >= v[x].fi) + (B[a] >= v2[y].fi) + (C[a] >= v3[z].fi) >= 2)x--;
		else if((A[b] >= v[x].fi) + (B[b] >= v2[y].fi) + (C[b] >= v3[z].fi) >= 2)y--;
		else if((A[c] >= v[x].fi) + (B[c] >= v2[y].fi) + (C[c] >= v3[z].fi) >= 2)z--;
		else {
			cout << v[x].fi + v2[y].fi + v3[z].fi << '\n';
			return;
		}
	}
	cout << -1;
}

main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int tc = 1;
	//cin >> tc;
	for(int tc1=1;tc1<=tc;tc1++){
		// cout << "Case #" << tc1 << ": ";
		solve();
	}
}

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

team.cpp:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | 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...