Submission #69077978


Source Code Expand

/* Code By WCm */
/*
Date:
大致思路:
复杂度:
期望得分:
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <vector>
#include <queue>
#define int long long

using namespace std;

inline int read();
void write(int);
void writeln(int);

const int N = 2e5 + 5;
int n, m, deg[N];

signed main() {

//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);

	n = read(), m = read();
	for(int i = 0; i < m; i++) {
		int u = read(), v = read();
		deg[u]++, deg[v]++;
	}
	
	int tar = (n - 1) & 1, cnt = 0;
	for(int i = 1; i <= n; i++) if((deg[i] & 1) != tar) cnt++;

	int ans = (n * (n - 1) >> 1) - (cnt >> 1);
	printf("%lld\n", ans);
	
//	printf("\nThe time used: ");
//	printf("%.2lfs",(double)clock()/CLOCKS_PER_SEC);

	return 0;

}

inline int read() {
	int res = 0, f = 1;
	char ch = getchar();
	while( !(ch >= '0' && ch <= '9') ) {
		if(ch == '-') f =  - 1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		res = (res << 1) + (res << 3) + (ch ^ 48);
		ch = getchar();
	}
	return res * f;
}

void write(int x) {
	static int sta[35];
	int top = 0;
	do {
		sta[top++] = x % 10;
		x /= 10;
	} while(x);
	while(top) putchar(sta[--top] ^ 48);
}

void writeln(int x) {
	write(x);
	putchar('\n');
}

Submission Info

Submission Time
Task B - Triangle Toggle
User WZwangchongming
Language C++ 20 (gcc 12.2)
Score 500
Code Size 1372 Byte
Status AC
Exec Time 11 ms
Memory 5308 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 3612 KiB
00_sample_01.txt AC 1 ms 3616 KiB
00_sample_02.txt AC 1 ms 3752 KiB
01_handmade_00.txt AC 1 ms 3624 KiB
01_handmade_01.txt AC 7 ms 5240 KiB
01_handmade_02.txt AC 6 ms 5208 KiB
01_handmade_03.txt AC 1 ms 3656 KiB
01_handmade_04.txt AC 1 ms 3748 KiB
01_handmade_05.txt AC 1 ms 3660 KiB
01_handmade_06.txt AC 1 ms 3596 KiB
01_handmade_07.txt AC 6 ms 3748 KiB
01_handmade_08.txt AC 6 ms 3756 KiB
02_random_00.txt AC 7 ms 4084 KiB
02_random_01.txt AC 9 ms 3912 KiB
02_random_02.txt AC 4 ms 4740 KiB
02_random_03.txt AC 9 ms 4236 KiB
02_random_04.txt AC 4 ms 3796 KiB
02_random_05.txt AC 11 ms 5184 KiB
02_random_06.txt AC 7 ms 5148 KiB
02_random_07.txt AC 11 ms 5184 KiB
02_random_08.txt AC 11 ms 5304 KiB
02_random_09.txt AC 11 ms 5308 KiB