Submission #494275

#TimeUsernameProblemLanguageResultExecution timeMemory
494275CjSidharthBest Place (NOI17_bestplace)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define REP(i,a,b) for(int i = a; i < b;i++) #define int long6 long using namespace std; signed main() { int n,mx,my; cin >> n; vector<int> x(n), y(n); REP(i,0,n) { cin >> x[i] >> y[n]; } sort(x.begin(),x.end()); sort(y.begin(),y.end()); if(n %2 == 0) { mx = x[n/2]; my = y[n/2]; } else { mx = (x[(n-1)/2] + x[(n+1)/2])/2; my = (y[(n-1)/2] + y[(n+1)/2])/2; } cout << mx<< " " << my; }

Compilation message (stderr)

bestplace.cpp: In function 'int main()':
bestplace.cpp:3:13: error: 'long6' was not declared in this scope; did you mean 'long'?
    3 | #define int long6 long
      |             ^~~~~
bestplace.cpp:7:5: note: in expansion of macro 'int'
    7 |     int n,mx,my; cin >> n;
      |     ^~~
bestplace.cpp:7:25: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     int n,mx,my; cin >> n;
      |                         ^
      |                         yn
bestplace.cpp:8:15: error: template argument 2 is invalid
    8 |     vector<int> x(n), y(n);
      |               ^
bestplace.cpp:3:19: error: expected ';' before 'long'
    3 | #define int long6 long
      |                   ^~~~
bestplace.cpp:2:24: note: in expansion of macro 'int'
    2 | #define REP(i,a,b) for(int i = a; i < b;i++)
      |                        ^~~
bestplace.cpp:9:5: note: in expansion of macro 'REP'
    9 |     REP(i,0,n)
      |     ^~~
bestplace.cpp:9:9: error: 'i' was not declared in this scope
    9 |     REP(i,0,n)
      |         ^
bestplace.cpp:2:35: note: in definition of macro 'REP'
    2 | #define REP(i,a,b) for(int i = a; i < b;i++)
      |                                   ^
bestplace.cpp:13:12: error: request for member 'begin' in 'x', which is of non-class type 'int'
   13 |     sort(x.begin(),x.end());
      |            ^~~~~
bestplace.cpp:13:22: error: request for member 'end' in 'x', which is of non-class type 'int'
   13 |     sort(x.begin(),x.end());
      |                      ^~~
bestplace.cpp:14:12: error: request for member 'begin' in 'y', which is of non-class type 'int'
   14 |     sort(y.begin(),y.end());
      |            ^~~~~
bestplace.cpp:14:22: error: request for member 'end' in 'y', which is of non-class type 'int'
   14 |     sort(y.begin(),y.end());
      |                      ^~~
bestplace.cpp:17:9: error: 'mx' was not declared in this scope; did you mean 'x'?
   17 |         mx = x[n/2];
      |         ^~
      |         x
bestplace.cpp:18:9: error: 'my' was not declared in this scope; did you mean 'y'?
   18 |         my = y[n/2];
      |         ^~
      |         y
bestplace.cpp:22:9: error: 'mx' was not declared in this scope; did you mean 'x'?
   22 |         mx = (x[(n-1)/2] + x[(n+1)/2])/2;
      |         ^~
      |         x
bestplace.cpp:23:9: error: 'my' was not declared in this scope; did you mean 'y'?
   23 |         my = (y[(n-1)/2] + y[(n+1)/2])/2;
      |         ^~
      |         y
bestplace.cpp:25:13: error: 'mx' was not declared in this scope; did you mean 'x'?
   25 |     cout << mx<< " " << my;
      |             ^~
      |             x
bestplace.cpp:25:25: error: 'my' was not declared in this scope; did you mean 'y'?
   25 |     cout << mx<< " " << my;
      |                         ^~
      |                         y