Submission #531098

# Submission time Handle Problem Language Result Execution time Memory
531098 2022-02-27T18:28:01 Z xuliu Sails (IOI07_sails) C++17
5 / 100
1000 ms 7696 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long 
#define ld long double 
#define debug if(0)

const int mod = 1e9 + 7;
const ll infL = 1e18 + 7;
const int inf = 1e9 + 7;

void add(int &a, int b) { a = (a+b)%mod; }
int add(int a, int b, int c) { int res = (((a+b)%mod) + c)%mod; return res; }

const int M = 1e5 + 4;
ll cnt[M];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vector<int> h(n), k(n);
	for(int i=0; i<n; i++) {
		cin>>h[i]>>k[i];
	}
	for(int i=0; i<n; i++) {
		set<pair<int, int>> S;
		for(int j=1; j<=h[i]; j++) {
			S.insert({cnt[j], j});
		}
		for(int j=0; j<k[i]; j++) {
			pair<int, int> p = *S.begin();
			S.erase(S.begin());
			cnt[p.second]++;
		}
	}
	ll ans = 0;
	for(int i=1; i<M; i++) {
		ans += ((cnt[i]*(cnt[i]-1))/2);
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 542 ms 556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 2076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 2512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 3964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 7236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 7484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 7696 KB Time limit exceeded
2 Halted 0 ms 0 KB -