QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#867174 | #9681. 猫粮 | SDSXC | Compile Error | / | / | C++14 | 936b | 2025-01-23 10:22:31 | 2025-01-23 10:22:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m;
int cnt[2][100009];
int tot1,tot2;
int main(){
freopen("catfood.in","r",stdin);
freopen("catfood.out","w",stdout);
int T;scanf("%d",&T);
while(T--){
memset(cnt,0,sizeof(cnt));
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){int x;scanf("%d",&x);cnt[0][x]++;}
for(int i=1;i<=n;i++){int x;scanf("%d",&x);cnt[1][x]++;}
bool flag=1;
for(int i=1;i<m;i++){
while(cnt[0][i]){
if(cnt[1][m-i]) --cnt[0][i],--cnt[1][m-i];
else if((m%2==0)&&(i==(m>>1))&&cnt[0][i]>1) cnt[0][i]-=2,++tot1;
else if((m%2||i!=(m>>1))&&cnt[0][m-i]) cnt[0][i]--,cnt[0][m-i]--,++tot2;
else {flag=0,puts("No");break;}
}
if(!flag) break;
}
if(!flag) continue;
for(int i=1;i<m;i++){
while(cnt[1][i]){
--cnt[1][i];--cnt[1][m-i];
if(cnt[m-i]<0){flag=0;break;}
}
}
if(!flag) {puts("No");continue;}
puts("Yes");
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:29:44: error: ordered comparison of pointer with integer zero (‘int*’ and ‘int’) 29 | if(cnt[m-i]<0){flag=0;break;} | ~~~~~~~~^~ answer.code:7:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | freopen("catfood.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ answer.code:8:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | freopen("catfood.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:9:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | int T;scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~ answer.code:13:50: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | for(int i=1;i<=n;i++){int x;scanf("%d",&x);cnt[0][x]++;} | ~~~~~^~~~~~~~~ answer.code:14:50: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | for(int i=1;i<=n;i++){int x;scanf("%d",&x);cnt[1][x]++;} | ~~~~~^~~~~~~~~