Submission #776827

# Submission time Handle Problem Language Result Execution time Memory
776827 2023-07-08T10:04:17 Z aZvezda Team Contest (JOI22_team) C++14
0 / 100
1 ms 312 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 ++) if(down[j] != up[k]) {
				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 ++) if(down[j] != up[k]) {
      |                  ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -