# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28063 | undecember | 컬러볼 (KOI15_ball) | C++14 | 136 ms | 5872 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n;
vector<pii> svt[2001]; // color, num
int csum[200001];
int ans[200001];
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
int tc, ts;
scanf("%d%d", &tc, &ts);
svt[ts].push_back(pii(tc, i));
}
int ssum = 0;
for (int i = 1; i <= 2000; i++)
{
for (auto sp : svt[i]) ans[sp.second] = ssum - csum[sp.first];
for (auto sp : svt[i])
{
csum[sp.first] += i;
ssum += i;
}
}
for (int i = 0; i < n; i++) printf("%d\n", ans[i]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |