Submission #69086483


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int n, m;
  cin >> n >> m;
  vector<int> x(n, (n - 1) % 2);
  while (m--) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    x[u] ^= 1;
    x[v] ^= 1;
  }
  cout << 1ll * n * (n - 1) / 2 - accumulate(x.begin(), x.end(), 0) / 2 << '\n';

  return 0;
}

Submission Info

Submission Time
Task B - Triangle Toggle
User achvanov
Language C++ 20 (gcc 12.2)
Score 500
Code Size 393 Byte
Status AC
Exec Time 20 ms
Memory 3880 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 22
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3508 KiB
00_sample_01.txt AC 1 ms 3496 KiB
00_sample_02.txt AC 1 ms 3528 KiB
01_handmade_00.txt AC 2 ms 3880 KiB
01_handmade_01.txt AC 12 ms 3816 KiB
01_handmade_02.txt AC 11 ms 3784 KiB
01_handmade_03.txt AC 1 ms 3364 KiB
01_handmade_04.txt AC 1 ms 3504 KiB
01_handmade_05.txt AC 1 ms 3440 KiB
01_handmade_06.txt AC 1 ms 3424 KiB
01_handmade_07.txt AC 15 ms 3640 KiB
01_handmade_08.txt AC 14 ms 3476 KiB
02_random_00.txt AC 15 ms 3508 KiB
02_random_01.txt AC 18 ms 3508 KiB
02_random_02.txt AC 5 ms 3528 KiB
02_random_03.txt AC 17 ms 3484 KiB
02_random_04.txt AC 8 ms 3592 KiB
02_random_05.txt AC 20 ms 3788 KiB
02_random_06.txt AC 11 ms 3820 KiB
02_random_07.txt AC 20 ms 3780 KiB
02_random_08.txt AC 19 ms 3864 KiB
02_random_09.txt AC 20 ms 3876 KiB