Submission #210277

# Submission time Handle Problem Language Result Execution time Memory
210277 2020-03-17T01:34:23 Z eric_xiao Xylophone (JOI18_xylophone) C++14
Compilation error
0 ms 0 KB
#include "xylophone.h"
#include<bits/stdc++.h>
using namespace std;
int A[100009],lf[100009],lf2[100009];
void solve(int N)
{
    int i,j,k,mn = 1000000000;
    vector<int> ck;
    A[1] = 0;
    A[2] = A[1]+query(1,2);
    ck.push_back(A[1]);
    ck.push_back(A[2]);
    mn = min(A[1],A[2]);
    for(i = 3;i <= N;i++)
    {
        lf[i] = query(i-1,i);
        lf2[i] = query(i-2,i);
        A[i] = A[i-1]+lf[i];
        if(max({A[i],A[i-1],A[i-2]}) - min({A[i],A[i-1],A[i-2]}) != lf2[i])
        {
            A[i] = A[i-1] - lf[i];
        }
        mn = min(mn,A[i]);
    }
    ll cg = 0,sm = 0;
    for(i = 1;i <= N;i++)
    {
        A[i] = A[i] - mn + 1;
        if(A[i] == 1) sm = 1;
        if(A[i] == N)
        {
            if(sm == 1) cg = 1;
        }
    }
    if(cg == 1)
    {
        for(i = 1;i <= N;i++)
        {
            A[i] = N + 1 - A[i];
        }
    }
    for(i = 1;i <= N;i++)
    {
        answer(i,A[i]);
    }
}

Compilation message

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:25:5: error: 'll' was not declared in this scope
     ll cg = 0,sm = 0;
     ^~
xylophone.cpp:25:5: note: suggested alternative: 'lf'
     ll cg = 0,sm = 0;
     ^~
     lf
xylophone.cpp:29:23: error: 'sm' was not declared in this scope
         if(A[i] == 1) sm = 1;
                       ^~
xylophone.cpp:29:23: note: suggested alternative: 'tm'
         if(A[i] == 1) sm = 1;
                       ^~
                       tm
xylophone.cpp:32:16: error: 'sm' was not declared in this scope
             if(sm == 1) cg = 1;
                ^~
xylophone.cpp:32:16: note: suggested alternative: 'tm'
             if(sm == 1) cg = 1;
                ^~
                tm
xylophone.cpp:32:25: error: 'cg' was not declared in this scope
             if(sm == 1) cg = 1;
                         ^~
xylophone.cpp:32:25: note: suggested alternative: 'ck'
             if(sm == 1) cg = 1;
                         ^~
                         ck
xylophone.cpp:35:8: error: 'cg' was not declared in this scope
     if(cg == 1)
        ^~
xylophone.cpp:35:8: note: suggested alternative: 'ck'
     if(cg == 1)
        ^~
        ck
xylophone.cpp:7:11: warning: unused variable 'j' [-Wunused-variable]
     int i,j,k,mn = 1000000000;
           ^
xylophone.cpp:7:13: warning: unused variable 'k' [-Wunused-variable]
     int i,j,k,mn = 1000000000;
             ^