Submission #62794735
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*
"The only way to do great work is to love what you do." – Steve Jobs
*/
// author: dheeraj
#include <bits/stdc++.h>
#include <vector>
#include<set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <iterator>
#include <climits> // For LONG_LONG_MAX
#include <iomanip> // For fixed and setprecision if needed
#include <numeric> // For accumulate
#include <sstream> // For stringstream
using namespace std;
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Asquare cout.tie(NULL);
// #define int long long
typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
const lld pi = 3.141592653589793238;
// const ll INF = LONG_LONG_MAX;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll, ll> umll;
typedef map<ll, ll> mll;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fl(i, n) for (int i = 0; i < n; i++)
#define rl(i, m, n) for (int i = n; i >= m; i--)
#define py cout << "YES\n";
#define pm cout << "-1\n";
#define pn cout << "NO\n";
#define vr(v) v.begin(), v.end()
#define rv(v) v.end(), v.begin()
template <typename T1, typename T2>
istream &operator>>(istream &istream, pair<T1, T2> &p) {
return (istream >> p.first >> p.second);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &ostream, const pair<T1, T2> &p) {
return (ostream << p.first << " " << p.second);
}
template <typename T>
void print(const T &t) {
cout << t << "\n";
}
void printarr(ll arr[], ll n) {
fl(i, n) cout << arr[i] << " ";
cout << "\n";
}
template <typename T>
void printvec(const vector<T> &v) {
for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
cout << *it << " ";
}
cout << "\n";
}
template <typename T>
ll sumvec(const vector<T> &v) {
ll s = 0;
fl(i, v.size()) s += v[i];
return s;
}
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
ll moduloMultiplication(ll a, ll b, ll mod) {
ll res = 0;
a %= mod;
while (b) {
if (b & 1) res = (res + a) % mod;
b >>= 1;
a = (a * 2) % mod;
}
return res;
}
ll powermod(ll x, ll y, ll p) {
ll res = 1;
x = x % p;
if (x == 0) return 0;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
bool sorta(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
bool sortd(const pair<int, int> &a, const pair<int, int> &b) { return (a.second > b.second); }
string decToBinary(int n) {
string s = "";
while (n > 0) {
s = to_string(n % 2) + s;
n = n / 2;
}
return s;
}
ll binaryToDecimal(const string &n) {
ll dec_value = 0;
int base = 1;
int len = n.length();
for (int i = len - 1; i >= 0; i--) {
if (n[i] == '1') dec_value += base;
base = base * 2;
}
return dec_value;
}
bool isPrime(ll n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0) return false;
return true;
}
bool isPowerOfTwo(int n) { return (n && !(n & (n - 1))); }
bool isPerfectSquare(ll x) {
if (x >= 0) {
ll sr = sqrt(x);
return (sr * sr == x);
}
return false;
}
void getPrime(ll p, map < ll, ll >&ma){
while(p%2 == 0) {
ma[2]++;
p/=2;
}
for(ll i = 3; i <= sqrt(p); i++) {
while(p%i == 0) {
ma[i]++;
p/=i;
}
}
if(p > 1)
ma[p]++;
}
bool has_seven(ll n) {
while (n) {
if (n % 10 == 7) return true;
n /= 10;
}
return false;
}
void solve()
{
set<pair<int,int>>ss;
int n,m;
cin>>n>>m;
long long ans=0;
while(m--)
{
int a,b;
cin>>a>>b;
if(a!=b)
{
if(a<b)
swap(a,b);
if(ss.count({a,b}))
ans++;
else
ss.insert({a,b});
}
else
{
ans++;
}
}
cout<<ans<<endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
// cin>>t;
while(t--)
{
solve();
}
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Make it Simple |
User |
dheeraj_001 |
Language |
C++ 17 (gcc 12.2) |
Score |
300 |
Code Size |
4777 Byte |
Status |
AC |
Exec Time |
497 ms |
Memory |
27008 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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_n_small_00.txt, 01_n_small_01.txt, 01_n_small_02.txt, 01_n_small_03.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, 03_corner_00.txt, 03_corner_01.txt, 03_corner_02.txt, 03_corner_03.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
1 ms |
3504 KB |
00_sample_01.txt |
AC |
1 ms |
3492 KB |
00_sample_02.txt |
AC |
1 ms |
3508 KB |
01_n_small_00.txt |
AC |
43 ms |
3524 KB |
01_n_small_01.txt |
AC |
34 ms |
3428 KB |
01_n_small_02.txt |
AC |
56 ms |
3536 KB |
01_n_small_03.txt |
AC |
34 ms |
3536 KB |
02_random_00.txt |
AC |
270 ms |
17384 KB |
02_random_01.txt |
AC |
245 ms |
17108 KB |
02_random_02.txt |
AC |
484 ms |
26872 KB |
02_random_03.txt |
AC |
468 ms |
27008 KB |
02_random_04.txt |
AC |
386 ms |
23568 KB |
02_random_05.txt |
AC |
236 ms |
17364 KB |
02_random_06.txt |
AC |
497 ms |
26972 KB |
02_random_07.txt |
AC |
488 ms |
26956 KB |
03_corner_00.txt |
AC |
213 ms |
15232 KB |
03_corner_01.txt |
AC |
343 ms |
15232 KB |
03_corner_02.txt |
AC |
45 ms |
3672 KB |
03_corner_03.txt |
AC |
43 ms |
3472 KB |