Submission #565586

#TimeUsernameProblemLanguageResultExecution timeMemory
565586birthdaycakeXylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "xylophone.h" int A[5001][5001]; int ans[5001]; void solve(int N) { for(int i = 1; i <= N; i++) ans[i] = 0; for(int i = 1; i <= N; i++){ for(int j = i + 1; j <= N; j++){ int value = query(i,j); A[i][j] = value; A[j][i] = value; } } int j = 0; for(int i = 1; i <= N; i++){ set<int>x; for(int j = 1; j <= N; j++){ x.insert(A[i][j]); } if(x.size() == n){ ans[i] = N; j = i; break; } } for(int i = 1; i <= N; i++){ if(i != j) { ans[i] = abs(N - ans[i][j]); } } for(int i = 1; i <= N; i++) { answer(i, ans[i]); } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:24:9: error: 'set' was not declared in this scope
   24 |         set<int>x;
      |         ^~~
xylophone.cpp:24:9: note: suggested alternatives:
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from xylophone.cpp:1:
/usr/include/c++/10/bits/stl_set.h:94:11: note:   'std::set'
   94 |     class set
      |           ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from xylophone.cpp:1:
/usr/include/c++/10/set:78:13: note:   'std::pmr::set'
   78 |       using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>;
      |             ^~~
xylophone.cpp:24:13: error: expected primary-expression before 'int'
   24 |         set<int>x;
      |             ^~~
xylophone.cpp:26:13: error: 'x' was not declared in this scope
   26 |             x.insert(A[i][j]);
      |             ^
xylophone.cpp:28:12: error: 'x' was not declared in this scope
   28 |         if(x.size() == n){
      |            ^
xylophone.cpp:28:24: error: 'n' was not declared in this scope
   28 |         if(x.size() == n){
      |                        ^
xylophone.cpp:38:36: error: invalid types 'int[int]' for array subscript
   38 |             ans[i] = abs(N - ans[i][j]);
      |                                    ^