Submission #763235

# Submission time Handle Problem Language Result Execution time Memory
763235 2023-06-22T07:02:43 Z Polar_Bear_2007 Xylophone (JOI18_xylophone) C++17
Compilation error
0 ms 0 KB
#ifdef MINHDEPTRAI

#include "/Library/Developer/CommandLineTools/usr/include/c++/v1/bits/stdc++.h"  
#include <chrono>
#define __gcd(a, b) gcd(a, b)
using namespace std ::chrono;
#else 
#include <bits/stdc++.h>
#include <xylophone.h>
#endif

using namespace std;
#define foru(i, a, b) for(int i = a; i <= b; ++i)
#define ford(i, a, b) for(int i = a; i >= b; --i)
#define IOS ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp(a, b) make_pair(a, b)
#define endl '\n'

const int maxN = 2e6 + 5;
const int mod = 998244353;
const long long inf = 1e17;

vector<int> number, triple;
int dau[maxN], ans[maxN];
void solve(int n){
    int i = 1, j = 2;
    while(j <= N){
        number.push_back(query(i, j));
        i++;
        j++;
    }
    int k = 3;
    i = 1;
    while(k <= N){
        triple.push_back(query(i, k));
        i++;
        k++;
    }

    dau[0] = 1;
    for(int j = 0; j < (int) triple.size(); j++){
        if(triple[j] == number[j + 1] + number[j]){
            dau[j + 1] = dau[j];
        }
        else{
            dau[j + 1] = -dau[j];   
        }
    }
    bool check = true;
    int cnt = 0;
    while(check){
        ans[0] = ++cnt;
        if(cnt > N) break;

        for(int j = 1; j <= N - 1; j++){
            ans[j] = ans[j - 1] +  number[j - 1] * (-dau[j - 1]);
        }

        foru(j, 0, N - 1){
            if(ans[j] < 1 || ans[j] > N){
                break;
            }
            if(j == N - 1) check = false;
        }        
    }
    
    cnt = 0;
    while(check){
        ans[0] = ++cnt;
        
        if(cnt > N) break;
        for(int j = 1; j <= N - 1; j++){
            ans[j] = ans[j - 1] +  number[j - 1] * dau[j - 1];
            
        }

        foru(j, 0, N - 1){
            if(ans[j] < 1 || ans[j] > N){
                break;
            }
            
            if(j == N - 1) check = false;
        }
    }
    foru(j, 0, N - 1) answer(j + 1, ans[j]);
  
}

Compilation message

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:28:16: error: 'N' was not declared in this scope
   28 |     while(j <= N){
      |                ^
xylophone.cpp:35:16: error: 'N' was not declared in this scope
   35 |     while(k <= N){
      |                ^
xylophone.cpp:54:18: error: 'N' was not declared in this scope
   54 |         if(cnt > N) break;
      |                  ^
xylophone.cpp:56:29: error: 'N' was not declared in this scope
   56 |         for(int j = 1; j <= N - 1; j++){
      |                             ^
xylophone.cpp:60:20: error: 'N' was not declared in this scope
   60 |         foru(j, 0, N - 1){
      |                    ^
xylophone.cpp:14:43: note: in definition of macro 'foru'
   14 | #define foru(i, a, b) for(int i = a; i <= b; ++i)
      |                                           ^
xylophone.cpp:72:18: error: 'N' was not declared in this scope
   72 |         if(cnt > N) break;
      |                  ^
xylophone.cpp:73:29: error: 'N' was not declared in this scope
   73 |         for(int j = 1; j <= N - 1; j++){
      |                             ^
xylophone.cpp:78:20: error: 'N' was not declared in this scope
   78 |         foru(j, 0, N - 1){
      |                    ^
xylophone.cpp:14:43: note: in definition of macro 'foru'
   14 | #define foru(i, a, b) for(int i = a; i <= b; ++i)
      |                                           ^
xylophone.cpp:86:16: error: 'N' was not declared in this scope
   86 |     foru(j, 0, N - 1) answer(j + 1, ans[j]);
      |                ^
xylophone.cpp:14:43: note: in definition of macro 'foru'
   14 | #define foru(i, a, b) for(int i = a; i <= b; ++i)
      |                                           ^