답안 #28063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28063 2017-07-15T07:01:26 Z undecember 컬러볼 (KOI15_ball) C++14
25 / 25
136 ms 5872 KB
#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

ball.cpp: In function 'int main()':
ball.cpp:15:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
ball.cpp:20:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &tc, &ts);
                          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 99 ms 5872 KB Output is correct
2 Correct 113 ms 5872 KB Output is correct
3 Correct 109 ms 5872 KB Output is correct
4 Correct 136 ms 5872 KB Output is correct
5 Correct 123 ms 5872 KB Output is correct
6 Correct 3 ms 3760 KB Output is correct
7 Correct 0 ms 3760 KB Output is correct
8 Correct 0 ms 3760 KB Output is correct
9 Correct 0 ms 3760 KB Output is correct
10 Correct 3 ms 3760 KB Output is correct
11 Correct 96 ms 5872 KB Output is correct
12 Correct 89 ms 5872 KB Output is correct
13 Correct 99 ms 5872 KB Output is correct
14 Correct 83 ms 5872 KB Output is correct
15 Correct 76 ms 5872 KB Output is correct
16 Correct 89 ms 5872 KB Output is correct
17 Correct 126 ms 5872 KB Output is correct
18 Correct 119 ms 5872 KB Output is correct
19 Correct 96 ms 5872 KB Output is correct
20 Correct 123 ms 5872 KB Output is correct