답안 #776836

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776836 2023-07-08T10:10:01 Z aZvezda Team Contest (JOI22_team) C++14
8 / 100
2000 ms 1736 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const ll MAX_N = 1e5 + 10;
ll n;
pair<ll, pair<int, int> > p[MAX_N];

deque<ll> down, up;

void put_down(ll ind) {
	down.push_back(ind);
}

void put_up(ll ind) {
	up.push_back(ind);
}

signed main() {
	cin >> n;
	for(ll i = 0; i < n; i ++) {
		cin >> p[i].first >> p[i].second.first >> p[i].second.second;
	}
	sort(p, p + n);

	ll ptr = 0;
	ll ans = -1;
	for(ll i = 0; i < n; i ++) {
		while(ptr < i && p[ptr].first != p[i].first) {
			put_down(ptr);
			put_up(ptr);
			ptr ++;
		}
		for(ll j = 0; j < down.size(); j ++) {
			for(ll k = 0; k < up.size(); k ++) {
				int indj = down[j];
				int indk = down[k];
				if(
					p[indj].second.first > p[indk].second.first && 
					p[indj].second.first > p[i].second.first && 
					p[indj].second.second < p[indk].second.second &&
					p[i].second.second < p[indk].second.second
				) {
					ans = max(ans, p[down[j]].second.first + p[up[k]].second.second + p[i].first);
				}
			}
		}
	}

	cout << ans << endl;

    return 0;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:34:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for(ll j = 0; j < down.size(); j ++) {
      |                 ~~^~~~~~~~~~~~~
team.cpp:35:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |    for(ll k = 0; k < up.size(); k ++) {
      |                  ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 46 ms 296 KB Output is correct
15 Correct 13 ms 316 KB Output is correct
16 Correct 25 ms 304 KB Output is correct
17 Correct 25 ms 212 KB Output is correct
18 Correct 33 ms 320 KB Output is correct
19 Correct 37 ms 300 KB Output is correct
20 Correct 19 ms 312 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 18 ms 212 KB Output is correct
23 Correct 1 ms 308 KB Output is correct
24 Correct 19 ms 296 KB Output is correct
25 Correct 20 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 46 ms 296 KB Output is correct
15 Correct 13 ms 316 KB Output is correct
16 Correct 25 ms 304 KB Output is correct
17 Correct 25 ms 212 KB Output is correct
18 Correct 33 ms 320 KB Output is correct
19 Correct 37 ms 300 KB Output is correct
20 Correct 19 ms 312 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 18 ms 212 KB Output is correct
23 Correct 1 ms 308 KB Output is correct
24 Correct 19 ms 296 KB Output is correct
25 Correct 20 ms 316 KB Output is correct
26 Execution timed out 2052 ms 476 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 32 ms 1736 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 32 ms 1736 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 32 ms 1736 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 32 ms 1736 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 46 ms 296 KB Output is correct
15 Correct 13 ms 316 KB Output is correct
16 Correct 25 ms 304 KB Output is correct
17 Correct 25 ms 212 KB Output is correct
18 Correct 33 ms 320 KB Output is correct
19 Correct 37 ms 300 KB Output is correct
20 Correct 19 ms 312 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 18 ms 212 KB Output is correct
23 Correct 1 ms 308 KB Output is correct
24 Correct 19 ms 296 KB Output is correct
25 Correct 20 ms 316 KB Output is correct
26 Execution timed out 2052 ms 476 KB Time limit exceeded
27 Halted 0 ms 0 KB -