# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
18037 |
2016-01-18T15:09:40 Z |
gs14004 |
컬러볼 (KOI15_ball) |
C++14 |
|
125 ms |
7188 KB |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <bitset>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
lint ret[200005];
lint sum[200005], fsum;
struct elem{int c, s, i;}a[200005];
int n;
int main(){
scanf("%d",&n);
for(int i=0; i<n; i++){
scanf("%d %d",&a[i].c, &a[i].s);
a[i].i = i;
}
sort(a, a+n, [&](const elem &a, const elem &b){
return a.s < b.s;
});
for(int i=0; i<n; i++){
int e = i;
while(e < n && a[e].s == a[i].s) e++;
for(int j=i; j<e; j++){
ret[a[i].i] = fsum - sum[a[i].c];
}
for(int j=i; j<e; j++){
fsum += a[i].s;
sum[a[i].c] += a[i].s;
}
}
for(int i=0; i<n; i++){
printf("%lld\n",ret[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
7188 KB |
Output isn't correct |
2 |
Incorrect |
93 ms |
7188 KB |
Output isn't correct |
3 |
Incorrect |
111 ms |
7188 KB |
Output isn't correct |
4 |
Incorrect |
116 ms |
7188 KB |
Output isn't correct |
5 |
Incorrect |
116 ms |
7188 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
7188 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
7188 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
7188 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
7188 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
7188 KB |
Output isn't correct |
11 |
Incorrect |
92 ms |
7188 KB |
Output isn't correct |
12 |
Incorrect |
125 ms |
7188 KB |
Output isn't correct |
13 |
Incorrect |
102 ms |
7188 KB |
Output isn't correct |
14 |
Incorrect |
97 ms |
7188 KB |
Output isn't correct |
15 |
Incorrect |
100 ms |
7188 KB |
Output isn't correct |
16 |
Incorrect |
65 ms |
7188 KB |
Output isn't correct |
17 |
Incorrect |
90 ms |
7188 KB |
Output isn't correct |
18 |
Incorrect |
104 ms |
7188 KB |
Output isn't correct |
19 |
Incorrect |
91 ms |
7188 KB |
Output isn't correct |
20 |
Incorrect |
110 ms |
7188 KB |
Output isn't correct |