답안 #18850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18850 2016-02-16T02:20:14 Z pichulia 컬러볼 (KOI15_ball) C++
10 / 25
132 ms 5000 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
int n, m = 2000;
piii a[200009];
int s[3000];
int b[200009];
int r[200009];
int main() {
	int i, j, k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&a[i].first.second,&a[i].first.first);
		s[a[i].first.first] += a[i].first.first;
		a[i].second = i;
	}
	for(i=1; i<=m; i++)
		s[i] += s[i-1];
	sort(a,a+n);
	for(i=0; i<n; i++)
	{
		r[a[i].second] = s[a[i].first.first - 1] - b[a[i].first.second];
		b[a[i].first.second] += a[i].first.first;
	}
	for(i=0;i<n;i++)
		printf("%d\n",r[i]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 132 ms 5000 KB Output is correct
2 Correct 98 ms 5000 KB Output is correct
3 Correct 94 ms 5000 KB Output is correct
4 Correct 96 ms 5000 KB Output is correct
5 Correct 96 ms 5000 KB Output is correct
6 Incorrect 0 ms 5000 KB Output isn't correct
7 Incorrect 3 ms 5000 KB Output isn't correct
8 Correct 1 ms 5000 KB Output is correct
9 Correct 0 ms 5000 KB Output is correct
10 Correct 0 ms 5000 KB Output is correct
11 Incorrect 65 ms 5000 KB Output isn't correct
12 Incorrect 75 ms 5000 KB Output isn't correct
13 Incorrect 97 ms 5000 KB Output isn't correct
14 Incorrect 98 ms 5000 KB Output isn't correct
15 Incorrect 101 ms 5000 KB Output isn't correct
16 Incorrect 81 ms 5000 KB Output isn't correct
17 Incorrect 105 ms 5000 KB Output isn't correct
18 Incorrect 95 ms 5000 KB Output isn't correct
19 Incorrect 100 ms 5000 KB Output isn't correct
20 Incorrect 80 ms 5000 KB Output isn't correct