Submission #1290478

#TimeUsernameProblemLanguageResultExecution timeMemory
1290478dirtblockXylophone (JOI18_xylophone)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "xylophone.h" void solve(int n) { vector<int> a(n+1,0); a[1]=query(1,2); for(int i=2; i<=n; i++) { int x1=query(i,i+1); int x2=query(i-1,i+1); a[i]=a[i-1]+a*((abs(x-x2)==abs(a[i-1]-a[i-2]))==a[i-1]>a[i-2]? 1:-1); } int mn=0,mx=0; for(int i=1; i<=n; i++) { if(a[i]<a[mn]) mn=i; if(a[i]>a[mx]) mx=i; } bool ok=(mn<mx); for(int i=1; i<=n; i++) { answer(i,(ok? a[i-1]+1-mn:n-a[i-1]+mn)); } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:5:9: error: 'vector' was not declared in this scope
    5 |         vector<int> a(n+1,0);
      |         ^~~~~~
xylophone.cpp:5:9: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from xylophone.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
xylophone.cpp:5:16: error: expected primary-expression before 'int'
    5 |         vector<int> a(n+1,0);
      |                ^~~
xylophone.cpp:6:9: error: 'a' was not declared in this scope
    6 |         a[1]=query(1,2);
      |         ^
xylophone.cpp:10:37: error: 'x' was not declared in this scope; did you mean 'x2'?
   10 |                 a[i]=a[i-1]+a*((abs(x-x2)==abs(a[i-1]-a[i-2]))==a[i-1]>a[i-2]? 1:-1);
      |                                     ^
      |                                     x2