mrlolthe1st

Untitled

Oct 26th, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. int cnt[1000005] = {};
  4. int sum[1000005] = {};
  5. bool was[1000005] = {};
  6. signed main() {
  7. int n = 0;
  8. scanf("%d", &n);
  9. for(int i = 0; i < n; ++i) {
  10. int a, b, c;
  11. scanf("%d%d%d", &a, &b, &c);
  12. was[a] = 1;
  13. sum[a] += c;
  14. cnt[a]++;
  15. }
  16. for (int i = 0; i < 1e6 + 5; ++i)
  17. if (was[i]) {
  18. printf("%d %d %d\n", i, cnt[i], sum[i]);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment