제출 #833821

#제출 시각아이디문제언어결과실행 시간메모리
833821azik21은행 (IZhO14_bank)C++17
0 / 100
1 ms252 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(v) (v).begin() , (v).end() #define nn "\n" #define ex exit(0); #define sz(s) (int)(s).size() const int N = 2e5+5; int cnt , ans , bit , n , t , k ,x , a , b , res , p,sum , r , l ; char h; vector<int> v; int main(){ ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); map<int , int >mp; cin>> n >> t ; int m[n]; for(int i =0 ; i < n; i++){ cin>> m[i]; } for(int i = 0 ; i < t ; i++){ cin>> x; mp[x]++; v.pb(x); } sort(all(v)); int p[t+1]; p[0] = 0 ; for(int i = 0 ; i< t ; i++){ p[i+1]=p[i]+v[i]; } for(int i= 1 ; i<= t ; i++){ if(mp[m[0]]>0){ cout<<"YES"; ex; } if(p[i]==m[i]){ cout<<"YES"; ex; } if(p[i]>m[i]){ while(p[i]>m[i]){ p[i]-=p[l]; l++; } if(p[i]==m[i]){ cout<<"YES"; ex; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...