Submission #978465

# Submission time Handle Problem Language Result Execution time Memory
978465 2024-05-09T08:46:00 Z vjudge1 Team Contest (JOI22_team) C++17
0 / 100
2000 ms 12380 KB
#include <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;

int tt = 1, n;
ll x[200005], y[200005], z[200005];
pair<pair<ll, ll>, pair<ll, int>> p[200005];
ll mx;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i] >> y[i] >> z[i];
		p[i] = {{x[i], y[i]}, {z[i], i}};
	}
	sort(p + 1, p + n + 1);
	for(int i = 3; i <= n; i++){
		set<ll> st;
		vector<pair<ll, ll>> v;
		for(int j = i - 1; j >= 1; j--){
			if(p[i].first.first != p[j].first.first)
				v.push_back({p[j].first.second, j});
		}
		sort(v.begin(), v.end());
		// for(int j = 0; j < v.size(); j++){
		// 	if(j == 0) mx[j] = p[v[j].second].second.first;
		// 	else mx[j] = max(mx[j - 1], p[v[j].second].second.first);
		// }
		int last = 0;
		for(int j = 1; j < v.size(); j++){
			while(last < j && v[last].first != v[j].first){
				st.insert(p[v[last].second].second.first);
				last++;
			}
			if(!st.empty() && p[v[j].second].second.first < *st.rbegin() && p[v[j].second].first.second != p[i].first.second) mx = max(mx, p[i].first.first + v[j].first + *st.rbegin());
			// if(!st.empty()) cout << p[i].first.first << " " << v[j].first << " " << *st.rbegin() << "\n";
		}
	}
	if(mx == 0) cout << -1;
	else cout << mx;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:56:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   for(int j = 1; j < v.size(); j++){
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6740 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 7 ms 6492 KB Output is correct
15 Incorrect 3 ms 6492 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6740 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 7 ms 6492 KB Output is correct
15 Incorrect 3 ms 6492 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Execution timed out 2098 ms 12380 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Execution timed out 2098 ms 12380 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Execution timed out 2098 ms 12380 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6488 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6744 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Execution timed out 2098 ms 12380 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6740 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 7 ms 6492 KB Output is correct
15 Incorrect 3 ms 6492 KB Output isn't correct
16 Halted 0 ms 0 KB -