A
#include <iostream> using namespace std; int main() { long long n; cin>>n; if(n%4==0||n%4==3)cout<<0; else cout<<1; return 0; }
B
#include<bits/stdc++.h> using namespace std; pair<int,int>p[5005]; pair<int,int>p2[5005]; int freq[5005]; int k2,k,n,x; int main() { cin>>n>>k; k2=k; for(int i=0;i<n;i++) { cin>>x; freq[x]++; if(freq[x]>k) { cout<<"NO "; return 0; } p[i]=make_pair(x,i); } sort(p,p+n); for(int i=0;i<n;i++) { p2[i].first = p[i].second; if(k2==0) k2=k; p2[i].second = k2; k2--; } sort(p2,p2+n); cout<<"YES "; for(int i=0;i<n;i++) { cout<<p2[i].second<<" "; } cout<<endl; return 0; }
C
#include <bits/stdc++.h> using namespace std; int main() { int n,x,y; int ans=0; scanf("%d%d%d",&n,&x,&y); if(x>y) { printf("%d ",n); return 0; } for(int i=0;i<n;i++) { int t; scanf("%d",&t); if(t<=x){ ans++; } } printf("%d ",ans/2+ans%2); return 0; }