Submission #702789

#TimeUsernameProblemLanguageResultExecution timeMemory
702789salmonXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include 'xylophone.h'
using namespace std;
int lst[5100];
int q[5100];
void solve(int N){


    vector<int> v;

    int s, e, s1,e1;

    int en = 1;

    for(int i = N - 1; i >= 1; i--){
        if(query(1,i) != N - 1){
            en = 1 + 1;
        }
    }

    lst[en] = N;
    q[en] = 0;

    for(int i = en - 1; i > 0; i--){
        int v = query(i,i + 1);

        q[i] = query(i,en);
        if(q[i + 1] == q[i]){
            lst[i] = lst[i + 1] - v;
        }
        else{
            lst[i] = lst[i + 1] + v;
        }
    }

    for(int i = en + 1; i <= N; i++){
        int v = query(i - 1,i);

        q[i] = query(en,i);
        if(q[i - 1] == q[i]){
            lst[i] = lst[i - 1] - v;
        }
        else{
            lst[i] = lst[i - 1] + v;
        }
    }

    for(int i = 1; i <= N; i++){
        answer(i,lst[i]);
    }
}

Compilation message (stderr)

xylophone.cpp:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include 'xylophone.h'
      |          ^~~~~~~~~~~~~
xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:16:12: error: 'query' was not declared in this scope
   16 |         if(query(1,i) != N - 1){
      |            ^~~~~
xylophone.cpp:25:17: error: 'query' was not declared in this scope
   25 |         int v = query(i,i + 1);
      |                 ^~~~~
xylophone.cpp:37:17: error: 'query' was not declared in this scope
   37 |         int v = query(i - 1,i);
      |                 ^~~~~
xylophone.cpp:49:9: error: 'answer' was not declared in this scope
   49 |         answer(i,lst[i]);
      |         ^~~~~~
xylophone.cpp:11:9: warning: unused variable 's' [-Wunused-variable]
   11 |     int s, e, s1,e1;
      |         ^
xylophone.cpp:11:12: warning: unused variable 'e' [-Wunused-variable]
   11 |     int s, e, s1,e1;
      |            ^
xylophone.cpp:11:15: warning: unused variable 's1' [-Wunused-variable]
   11 |     int s, e, s1,e1;
      |               ^~
xylophone.cpp:11:18: warning: unused variable 'e1' [-Wunused-variable]
   11 |     int s, e, s1,e1;
      |                  ^~