File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Beginner/Chef Feeds Cats (CATFEED) Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < bits/stdc++.h>
2+ using namespace std ;
3+ #define loop (i,a,b ) for (int i=a;i<b;i++)
4+ #define loope (i,a,b ) for (int i=a;i<=b;i++)
5+ #define loopi (i,a,b ) for (int i=a;i>=b;i--)
6+ #define loopv (i,a,b,type ) for (vector<type>::iterator i=a;i!=b;i++)
7+ #define looplli (i,a,b ) for (lli i=a;i<b;i++)
8+ #define ll long long
9+
10+
11+ void solve (){
12+ ll int n,m,cat,roundno=0 ;
13+ cin>>n>>m;
14+ vector<ll int > feed (n,0 );
15+ bool fair = true ;
16+ loop (i,0 ,m){
17+ cin>>cat;
18+ if (i%n == 0 ){
19+ roundno++;
20+ }
21+ feed[cat-1 ]++;
22+ if (feed[cat-1 ]>roundno){
23+ fair = false ;
24+ }
25+ }
26+ if (fair){
27+ cout<<" YES" ;
28+ } else {
29+ cout<<" NO" ;
30+ }
31+ cout<<" \n " ;
32+
33+ }
34+
35+ int main (){
36+ ios_base::sync_with_stdio (0 ), cin.tie (0 ), cout.tie (0 );
37+ srand (chrono::high_resolution_clock::now ().time_since_epoch ().count ());
38+
39+ ll int t = 1 ;
40+ cin >> t;
41+ while (t--) {
42+ solve ();
43+ }
44+ // solve();
45+
46+ return 0 ;
47+ }
You can’t perform that action at this time.
0 commit comments