QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743211#6310. Dining Professorswuya#Compile Error//C++17608b2024-11-13 18:35:572024-11-13 18:35:59

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 18:35:59]
  • 评测
  • [2024-11-13 18:35:57]
  • 提交

answer

ll n, m;
ll a[N],s[N]={0},sum[4]={0};
void solve()
{
    cin>>n>>m;
    rep(i,1,n+1) 
    {
        cin>>a[i];
        if(a[i]==0) s[i-1]++,s[i]++,s[i+1]++;
    }
    s[1]+=s[n+1];s[n]+=s[0];
    ll m1=0;
    rep(i,1,n+1) 
    {
        sum[s[i]]++;
        if(s[i]!=0) m1++;
    }
    if(n-m1>=m) return cout<<n*3<<endl,void();
    m-=n-m1;
    ll ans=3*n;
    rep(i,1,4)
    {
        if(m>=sum[i])
        {
            m-=sum[i];
            ans-=sum[i]*i;
        }
        else
        {
            ans-=m*i;
            break;
        }
    }
    cout<<ans<<endl;
} 

詳細信息

answer.code:1:1: error: ‘ll’ does not name a type
    1 | ll n, m;
      | ^~
answer.code:2:1: error: ‘ll’ does not name a type
    2 | ll a[N],s[N]={0},sum[4]={0};
      | ^~
answer.code:2:17: error: expected unqualified-id before ‘,’ token
    2 | ll a[N],s[N]={0},sum[4]={0};
      |                 ^
answer.code:2:24: error: expected constructor, destructor, or type conversion before ‘=’ token
    2 | ll a[N],s[N]={0},sum[4]={0};
      |                        ^
answer.code: In function ‘void solve()’:
answer.code:5:5: error: ‘cin’ was not declared in this scope
    5 |     cin>>n>>m;
      |     ^~~
answer.code:5:10: error: ‘n’ was not declared in this scope
    5 |     cin>>n>>m;
      |          ^
answer.code:5:13: error: ‘m’ was not declared in this scope
    5 |     cin>>n>>m;
      |             ^
answer.code:6:9: error: ‘i’ was not declared in this scope
    6 |     rep(i,1,n+1)
      |         ^
answer.code:6:5: error: ‘rep’ was not declared in this scope
    6 |     rep(i,1,n+1)
      |     ^~~
answer.code:11:5: error: ‘s’ was not declared in this scope
   11 |     s[1]+=s[n+1];s[n]+=s[0];
      |     ^
answer.code:12:5: error: ‘ll’ was not declared in this scope
   12 |     ll m1=0;
      |     ^~
answer.code:18:10: error: ‘m1’ was not declared in this scope
   18 |     if(n-m1>=m) return cout<<n*3<<endl,void();
      |          ^~
answer.code:18:24: error: ‘cout’ was not declared in this scope
   18 |     if(n-m1>=m) return cout<<n*3<<endl,void();
      |                        ^~~~
answer.code:18:35: error: ‘endl’ was not declared in this scope
   18 |     if(n-m1>=m) return cout<<n*3<<endl,void();
      |                                   ^~~~
answer.code:19:10: error: ‘m1’ was not declared in this scope
   19 |     m-=n-m1;
      |          ^~
answer.code:20:7: error: expected ‘;’ before ‘ans’
   20 |     ll ans=3*n;
      |       ^~~~
      |       ;
answer.code:34:5: error: ‘cout’ was not declared in this scope
   34 |     cout<<ans<<endl;
      |     ^~~~
answer.code:34:11: error: ‘ans’ was not declared in this scope
   34 |     cout<<ans<<endl;
      |           ^~~
answer.code:34:16: error: ‘endl’ was not declared in this scope
   34 |     cout<<ans<<endl;
      |                ^~~~