Submission #1182809

#TimeUsernameProblemLanguageResultExecution timeMemory
1182809william889Advertisement 2 (JOI23_ho_t2)C++20
Compilation error
0 ms0 KiB
# include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n],b[n]; pair<int,int>v[n]; for(int i=0;i<n;i++){ cin>>a[i]>>b[i]; v[i].first=a[i]-b[i]; v[i].second=-a[i]-b[i]; } long long ans=0,cur=-1e9; for(int i=0;i<n;i++){ a[i].second=-a[i].second; if(a[i].second>cur){ ans++; cur=a[i].second; } } cout<<ans; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:15:22: error: request for member 'second' in 'a[i]', which is of non-class type 'int'
   15 |                 a[i].second=-a[i].second;
      |                      ^~~~~~
Main.cpp:15:35: error: request for member 'second' in 'a[i]', which is of non-class type 'int'
   15 |                 a[i].second=-a[i].second;
      |                                   ^~~~~~
Main.cpp:16:25: error: request for member 'second' in 'a[i]', which is of non-class type 'int'
   16 |                 if(a[i].second>cur){
      |                         ^~~~~~
Main.cpp:18:34: error: request for member 'second' in 'a[i]', which is of non-class type 'int'
   18 |                         cur=a[i].second;
      |                                  ^~~~~~