Submission #891302
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;
#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007
#define TIME chrono::system_clock::now
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())
template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}
int m,n;
int memo[100000];
int main(){
int i,j,k,l;
int counter = 0;
cin>>n;
for (i=1;i<=n;i++){
scanf("%d",&k);
if (memo[k]==i){
counter++;
}
memo[i]=k;
}
cout << counter<<endl;
return 0;
}
Submission Info
Submission Time
2016-09-24 21:05:05+0900
Task
B - Friendly Rabbits
User
m_buyoh
Language
C++14 (GCC 5.4.1)
Score
200
Code Size
1252 Byte
Status
AC
Exec Time
13 ms
Memory
640 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:34:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&k);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
200 / 200
Status
Set Name
Test Cases
Sample
0_00.txt, 0_01.txt, 0_02.txt
All
0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt
Case Name
Status
Exec Time
Memory
0_00.txt
AC
3 ms
256 KB
0_01.txt
AC
3 ms
384 KB
0_02.txt
AC
3 ms
256 KB
1_00.txt
AC
2 ms
256 KB
1_01.txt
AC
13 ms
640 KB
1_02.txt
AC
13 ms
640 KB
1_03.txt
AC
13 ms
640 KB
1_04.txt
AC
13 ms
640 KB
1_05.txt
AC
13 ms
640 KB
1_06.txt
AC
13 ms
640 KB
1_07.txt
AC
13 ms
640 KB
1_08.txt
AC
6 ms
384 KB
1_09.txt
AC
11 ms
512 KB
1_10.txt
AC
9 ms
512 KB
1_11.txt
AC
4 ms
256 KB