Submission #19723204


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<pair<int,int> >vp(n);
  vector<int>a(400001),b(400001);
  for(int i=0;i<n;i++)
  {
    cin>>vp[i].first>>vp[i].second;
    a[vp[i].first]++;
    b[vp[i].second]++;
  }
  for(int i = 0 ;i<n ; i++)
  {
	if(vp[i].first == vp[i].second)continue;
    if(a[vp[i].second] == 0 && a[vp[i].first] !=1) 
    {
		a[vp[i].second]++;
     	a[vp[i].first]--;
    }
  }
  int count = 0 ;
  for(int x : a)
  {
    if(x)count++;
  }
  cout<<count<<endl;
	return 0;
}
    
  

Submission Info

Submission Time
Task B - Reversible Cards
User dazais
Language C++ (GCC 9.2.1)
Score 0
Code Size 575 Byte
Status WA
Exec Time 108 ms
Memory 8000 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 18
WA × 9
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt
Case Name Status Exec Time Memory
0_000.txt AC 10 ms 6164 KB
0_001.txt AC 11 ms 6352 KB
0_002.txt AC 10 ms 6276 KB
1_003.txt WA 6 ms 6404 KB
1_004.txt AC 7 ms 6160 KB
1_005.txt AC 63 ms 7888 KB
1_006.txt WA 9 ms 6164 KB
1_007.txt AC 10 ms 6344 KB
1_008.txt AC 72 ms 7896 KB
1_009.txt WA 107 ms 7936 KB
1_010.txt WA 108 ms 7804 KB
1_011.txt WA 108 ms 7892 KB
1_012.txt AC 99 ms 7936 KB
1_013.txt AC 99 ms 7916 KB
1_014.txt AC 100 ms 7744 KB
1_015.txt AC 84 ms 8000 KB
1_016.txt AC 6 ms 6240 KB
1_017.txt AC 25 ms 6484 KB
1_018.txt AC 44 ms 6688 KB
1_019.txt AC 97 ms 7864 KB
1_020.txt AC 100 ms 7888 KB
1_021.txt AC 10 ms 6352 KB
1_022.txt AC 6 ms 6404 KB
1_023.txt WA 84 ms 7632 KB
1_024.txt WA 51 ms 6932 KB
1_025.txt WA 102 ms 7928 KB
1_026.txt WA 63 ms 6948 KB