QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376600#2164. Landscape Generatorinstallb#Compile Error//C++201.2kb2024-04-04 13:45:232024-04-04 13:45:24

Judging History

This is the latest submission verdict.

  • [2024-04-04 13:45:24]
  • Judged
  • [2024-04-04 13:45:23]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define M 200005
int n,K;
using ll = long long;
ll dif[2][M],dif2[2][M];
void Update1(int l,int r,int f){
    if(l>r)return;
    dif2[f][l]++,dif2[f][r+1]--;
    dif[f][r+1] -= r-l+1;
}
void Update2(int l,int r,int f){
    if(l>r)return;
    dif2[f][l]--,dif2[f][r+1]++;
    dif[f][l] += r-l+2;
    dif[f][r+1]--;
}
int main(){
    cin>>n>>K;
    for(int i=1,l,r;i<=K;i++){
        char op[5];
        scanf("%s%d%d",op,&l,&r);
        if(op[0]=='R')dif[0][l]++,dif[0][r+1]--;
        else if(op[0]=='D')dif[0][l]--,dif[0][r+1]++;
        else if(op[0]=='H'){
            int m = r+l>>1;
            Update1(l,m,0);
            Update2(m+1,r,0);
        }else{
            int m = r+l>>1;
            Update2(l,m,1);
            Update1(m+1,r,1);
        }
    }
    for(int i=0;i<2;i++){
        for(int j=1;j<=n;j++)
            dif[i][j] += dif[i][j-1];
        for(int j=1;j<=n;j++)
            dif2[i][j] += dif2[i][j-1];
        for(int j=1;j<=n;j++)
            dif2[i][j] += dif2[i][j-1];
    }
    for(int i=1;i<=n;i++)
        printf("%lld\n",dif[0][i]+dif2[0][i] - dif[1][i]-dif2[1][i]);
    return 0;
}asd

详细

answer.code:46:2: error: ‘asd’ does not name a type
   46 | }asd
      |  ^~~
answer.code: In function ‘int main()’:
answer.code:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         scanf("%s%d%d",op,&l,&r);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~