Submission #1008729

# Submission time Handle Problem Language Result Execution time Memory
1008729 2024-06-26T17:04:28 Z Rolo678 Labels (NOI20_labels) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  cin >>n;
  vector<int>d(n);
  for(int i = 1;i<n;i++)
  {
    cin >>d[i];
  }
  if(abs(d[1]) != 2*n-2) cout<<-1<<'\n';
  else if (d[i] == -2*n + 2) cout<< n-1 << ' '<< -n+1 <<'\n';
  else if (d[i] == 2*n-2) cout<< -n+1 << ' '<< n-1 <<'\n';
}

Compilation message

Labels.cpp: In function 'int main()':
Labels.cpp:14:14: error: 'i' was not declared in this scope
   14 |   else if (d[i] == -2*n + 2) cout<< n-1 << ' '<< -n+1 <<'\n';
      |              ^