Submission #18052

# Submission time Handle Problem Language Result Execution time Memory
18052 2016-01-19T10:06:09 Z chan492811 컬러볼 (KOI15_ball) C++
0 / 25
115 ms 4988 KB
#include <cstdio>
#include <algorithm>
using namespace std;
int n,sum;
struct data{
    int z,x,idx;
};
data arr[200010];
int index[200010],color[200010];
bool compare(data d1,data d2){
    return d1.x<d2.x;
}
int main(){
    int i;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d %d",&arr[i].z,&arr[i].x),arr[i].idx=i;
    sort(arr,arr+n,compare);
    for(i=0;i<n;i++){
        index[arr[i].idx]=sum-color[arr[i].z];
        sum+=arr[i].x; color[arr[i].z]+=arr[i].x;
    }
    for(i=0;i<n;i++) printf("%d\n",index[i]);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 4988 KB Output isn't correct
2 Incorrect 99 ms 4988 KB Output isn't correct
3 Incorrect 106 ms 4988 KB Output isn't correct
4 Incorrect 113 ms 4988 KB Output isn't correct
5 Incorrect 79 ms 4988 KB Output isn't correct
6 Incorrect 1 ms 4988 KB Output isn't correct
7 Incorrect 2 ms 4988 KB Output isn't correct
8 Incorrect 0 ms 4988 KB Output isn't correct
9 Incorrect 0 ms 4988 KB Output isn't correct
10 Incorrect 0 ms 4988 KB Output isn't correct
11 Incorrect 111 ms 4988 KB Output isn't correct
12 Incorrect 80 ms 4988 KB Output isn't correct
13 Incorrect 107 ms 4988 KB Output isn't correct
14 Incorrect 115 ms 4988 KB Output isn't correct
15 Incorrect 72 ms 4988 KB Output isn't correct
16 Incorrect 88 ms 4988 KB Output isn't correct
17 Incorrect 82 ms 4988 KB Output isn't correct
18 Incorrect 97 ms 4988 KB Output isn't correct
19 Incorrect 107 ms 4988 KB Output isn't correct
20 Incorrect 102 ms 4988 KB Output isn't correct