Submission #3767182
Source Code Expand
#include<bits/stdc++.h> using namespace std; int maxx=0,minx=100025,c1=0,c2=0,n,x; int max(int a,int b) { if (a>b) return a; } int min(int a,int b) { if (a<b) return a; } int main() { scanf("%d",&n); for (int i=1;i<=n;i++) { scanf("%d",&x); if (maxx=x) {c1++;continue;} if (minx=x) {c2++;continue;} maxx=max(x,maxx);minx=min(x,minx); if (maxx=x) c1=1; if (minx=x) c2=1; } if (maxx-minx>1) cout<<"No"; else if (maxx=minx&&c2=n||c2*2<=n) cout<<"Yes"; else if (maxx=minx+1&&(minx<c2||(maxx-c2)*2>n-c2)) cout<<"Yes"; else cout<<"No"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Hats |
User | luogu_bot3 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 616 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:30:25: error: lvalue required as left operand of assignment else if (maxx=minx&&c2=n||c2*2<=n) cout<<"Yes"; ^ ./Main.cpp:19:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:22:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&x); ^