답안 #965931

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965931 2024-04-19T08:08:11 Z PM1 Team Contest (JOI22_team) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxn=2e5;
int n,a[mxn][3];
vector<int>z,zz,zzz;
bool cmp1(int x,int y){
	return a[x][0]<a[y][0];
}
bool cmp2(int x,int y){
	return a[x][1]<a[y][1];
}
bool cmp3(int x,int y){
	return a[x][2]<a[y][2];
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		z.push_back(i);
	}
	zzz=zz=z;
	sort(z.begin(),z.end(),cmp1);
	sort(zz.begin(),zz.end(),cmp2);
	sort(zzz.begin(),zzz.end(),cmp3);
	int p1=n-1,p2=n-1,p3=n-1;
	while(p1>-1 && p2>-1 && p3>-1){
		if(a[z[p1]][0]<= a[zz[p2]][0]){
			p2--;
			continue;
		}
		if(a[z[p1]][0]<= a[zzz[p3]][0]){
			p3--;
			continue;
		}
		if(a[zz[p2]][1]<= a[z[p1]][1]){
			p1--;
			continue;
		}
		if(a[zz[p2]][1]<= a[zzz[p3]][1]){
			p3--;
			continue;
		}
		if(a[zzz[p3]][2]<= a[z[p1]][2]){
			p1--;
			continue;
		}
		if(a[zzz[p3]][2]<= a[zz[p2]][2]){
			p2--;
			continue;
		}
		/cout<<z[p1]<<" "<<zz[p2]<<" "<<zzz[p3]<<'\n';
		cout<<a[z[p1]][0]+a[zz[p2]][1]+a[zzz[p3]][2];
		return 0;
	}
	cout<<-1;
	return 0;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:55:3: error: expected primary-expression before '/' token
   55 |   /cout<<z[p1]<<" "<<zz[p2]<<" "<<zzz[p3]<<'\n';
      |   ^