QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133626#4935. Exchange Bottlenecknameless_story#Compile Error//C++14663b2023-08-02 12:08:452023-08-02 12:09:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 12:09:04]
  • 评测
  • [2023-08-02 12:08:45]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    vector a(n+1,0);
    for(int i=2;i<=n;i++)
    cin>>a[i];
    int tp=2;
    for(int i=n;i>2;i--)
    if(a[i])
    {
        tp=i;
        break;
    }
    if(tp==2)
    {
        cout<<n-1<<'\n';
        return 0;
    }
    if(tp<n)
    {
        cout<<n-tp+1<<'\n';
        return 0;
    }
    if(*min_element(a.begin()+3,a.end())==0)
    cout<<2<<'\n';
    else
    cout<<1<<'\n';
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:14:12: error: missing template arguments before ‘a’
   14 |     vector a(n+1,0);
      |            ^
answer.code:16:10: error: ‘a’ was not declared in this scope
   16 |     cin>>a[i];
      |          ^
answer.code:19:8: error: ‘a’ was not declared in this scope
   19 |     if(a[i])
      |        ^
answer.code:34:21: error: ‘a’ was not declared in this scope
   34 |     if(*min_element(a.begin()+3,a.end())==0)
      |                     ^