Submission #1692347
Source Code Expand
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define endl '\n'
#define gcd __gcd
#define lcm(a,b) (a*b)/gcd(a,b)
#define inf 0xFFFFFFFF/2
#define uinf 0xFFFFFFFF
#define infl 0xFFFFFFFFFFFFFFFF/2
#define uinfl 0xFFFFFFFFFFFFFFFF
#define TEST int t; cin>>t; while(t--)
#define rep(i,a,b) for(int i=(int)a; i<b; i++)
#define repc(i,a,c) for(int i=(int)a; c; i++)
#define reps(i,a,b,s) for(int i=(int)a; i<b; i+=s)
#define repcs(i,a,c,s) for(int i=(int)a; c; i+=s)
#define repn(i,n) for(int i=0; i<n; i++)
#define per(i,a,b) for(int i=b; i >= a; i--)
#define linv(a,n) vector<int> a(n); for(int i=0; i<n; i++) cin>>a[i];
#define linp(a,n) int arr[n]; for(int i=0; i<n; i++) cin>>a[i];
#define lgenv(t,a,n) vector<t> a(n); for(int i=0; i<n; i++) cin>>a[i];
#define lgenp(t,a,n) t a[n]; for(int i=0; i<n; i++) cin>>a[i];
#define lgeni(t,a,n,v) t a[n]; memset(a, v, (sizeof(a)/sizeof(t)));
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define SZ(x) (x).size()
#define DEBUG_ARR(a,n) for(int i=0; i<n; i++) cerr<<a[i]<<" "; cerr<<endl;
#define PRINT_ARR(a,n) for(int i=0; i<n; i++) cout<<a[i]<<" "; cout<<endl;
#define RD_I(fi) freopen(fi, "r", stdin);
#define RD_O(fo) freopen(fo, "w", stdout);
#define RD_IO(fi,fo) RD_I(fi); RD_O(fo);
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long llu;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector< vector<int> > vvi;
int main()
{
FIO
int n;
cin>>n;
linv(d,n);
int m;
cin>>m;
linv(t,m);
map<int, int> hmap;
repn(i, n)
{
if(hmap.find(d[i]) == hmap.end())
hmap[d[i]] = 1;
else
hmap[d[i]]++;
}
bool poss = true;
repn(i,m)
{
if(hmap.find(t[i]) == hmap.end())
{
poss = false;
break;
}
else if(hmap[t[i]] <= 0)
{
poss = false;
break;
}
else
hmap[t[i]]--;
}
cout<<(poss ? "YES" : "NO")<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Problem Set |
User |
laid_to_rest |
Language |
C++14 (GCC 5.4.1) |
Score |
200 |
Code Size |
2073 Byte |
Status |
AC |
Exec Time |
226 ms |
Memory |
11264 KB |
Judge Result
Set Name |
sample |
dataset1 |
dataset2 |
Score / Max Score |
0 / 0 |
100 / 100 |
100 / 100 |
Status |
|
|
|
Set Name |
Test Cases |
sample |
sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
dataset1 |
sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt |
dataset2 |
sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
Case Name |
Status |
Exec Time |
Memory |
01-01.txt |
AC |
1 ms |
256 KB |
01-02.txt |
AC |
1 ms |
256 KB |
01-03.txt |
AC |
1 ms |
256 KB |
01-04.txt |
AC |
1 ms |
256 KB |
01-05.txt |
AC |
1 ms |
256 KB |
01-06.txt |
AC |
1 ms |
256 KB |
01-07.txt |
AC |
1 ms |
256 KB |
01-08.txt |
AC |
1 ms |
256 KB |
01-09.txt |
AC |
1 ms |
256 KB |
02-01.txt |
AC |
106 ms |
10368 KB |
02-02.txt |
AC |
112 ms |
10496 KB |
02-03.txt |
AC |
226 ms |
11264 KB |
02-04.txt |
AC |
110 ms |
10496 KB |
02-05.txt |
AC |
135 ms |
11264 KB |
02-06.txt |
AC |
25 ms |
1024 KB |
02-07.txt |
AC |
49 ms |
1792 KB |
02-08.txt |
AC |
50 ms |
1792 KB |
02-09.txt |
AC |
50 ms |
1792 KB |
02-10.txt |
AC |
51 ms |
1792 KB |
sample-01.txt |
AC |
1 ms |
256 KB |
sample-02.txt |
AC |
1 ms |
256 KB |
sample-03.txt |
AC |
1 ms |
256 KB |
sample-04.txt |
AC |
1 ms |
256 KB |