Submission #28063

#TimeUsernameProblemLanguageResultExecution timeMemory
28063undecember컬러볼 (KOI15_ball)C++14
25 / 25
136 ms5872 KiB
#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)

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);
                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...