#2327580

Solution for ALDS1_4_A: Linear Search by pasta_az

Source Code Status Test Cases
    Policy: public     Reviewed: 0    
00.00 sec    3080 KB    22 lines     308 bytes    2017-05-20 03:19
#include<bits/stdc++.h>
using namespace std;
int n,q,s[10010],t,cnt;
int srch(int t){
  s[n]=t;
  int i=0;
  while(s[i]!=t) ++i;
  return i!=n;
}
int main(){
  cin>>n;
  for(int i=0;i<n;++i) cin>>s[i];
  cin>>q;
  for(int i=0;i<q;++i){
    cin>>t;
    if(srch(t)) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}


Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 10/10 C++ CPU: 00.00 sec Memory: 3080 KB Length: 308 B 2017-05-20 03:19 2017-05-20 03:19
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.00 sec 3076 KB
Case #2: : Accepted 00.00 sec 3044 KB
Case #3: : Accepted 00.00 sec 3068 KB
Case #4: : Accepted 00.00 sec 3044 KB
Case #5: : Accepted 00.00 sec 3080 KB
Case #6: : Accepted 00.00 sec 3068 KB
Case #7: : Accepted 00.00 sec 3076 KB
Case #8: : Accepted 00.00 sec 3068 KB
Case #9: : Accepted 00.00 sec 3004 KB
Case #10: : Accepted 00.00 sec 3032 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags