Submission #1125259

#TimeUsernameProblemLanguageResultExecution timeMemory
1125259codexistentSorting (IOI15_sorting)C++20
Compilation error
0 ms0 KiB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 200005
#define FOR(i, a, b) for(ll i = a; i <= b; i++)

ll p*, x*, s*, q*, r*;
vector<pair<ll, ll>> r;

ll st[MAXN], ed[MAXN];
bool v[MAXN];

vector<pair<ll, ll>> valid(ll m){
    FOR(i, 0, n - 1) st[i] = i, v[i] = false;
    FOR(i, 0, m - 1) swap(st[x[i]], st[y[i]]);

    FOR(i, 0, n - 1) ed[st[i]] = i;
    FOR(sti, 0, n - 1) if(!v[sti]) {
        ll i = sti;
        do{

        }while(i != sti);
    }
}

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    n = N;
    FOR(i, 0, n - 1) on[i] = S[i];
    FOR(i, 0, M - 1) x[i] = X[i], y[i] = Y[i];

    ll lo = 0, hi = M;
    while(lo < hi){
        ll md = (lo + hi) / 2;
        r = valid(md);
        if(r.size() <= md){
            hi = md;
        }else{
            lo = md + 1;
        }
    }

    FOR(i, 0, r.size() - 1) P[i] = r[i].first, Q[i] = r[i].second;
    return lo;
}

Compilation message (stderr)

sorting.cpp:8:5: error: expected initializer before '*' token
    8 | ll p*, x*, s*, q*, r*;
      |     ^
sorting.cpp: In function 'std::vector<std::pair<long long int, long long int> > valid(long long int)':
sorting.cpp:15:15: error: 'n' was not declared in this scope
   15 |     FOR(i, 0, n - 1) st[i] = i, v[i] = false;
      |               ^
sorting.cpp:6:41: note: in definition of macro 'FOR'
    6 | #define FOR(i, a, b) for(ll i = a; i <= b; i++)
      |                                         ^
sorting.cpp:16:30: error: 'x' was not declared in this scope
   16 |     FOR(i, 0, m - 1) swap(st[x[i]], st[y[i]]);
      |                              ^
sorting.cpp:16:40: error: 'y' was not declared in this scope
   16 |     FOR(i, 0, m - 1) swap(st[x[i]], st[y[i]]);
      |                                        ^
sorting.cpp:18:15: error: 'n' was not declared in this scope
   18 |     FOR(i, 0, n - 1) ed[st[i]] = i;
      |               ^
sorting.cpp:6:41: note: in definition of macro 'FOR'
    6 | #define FOR(i, a, b) for(ll i = a; i <= b; i++)
      |                                         ^
sorting.cpp:19:17: error: 'n' was not declared in this scope
   19 |     FOR(sti, 0, n - 1) if(!v[sti]) {
      |                 ^
sorting.cpp:6:41: note: in definition of macro 'FOR'
    6 | #define FOR(i, a, b) for(ll i = a; i <= b; i++)
      |                                         ^
sorting.cpp:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:28:5: error: 'n' was not declared in this scope
   28 |     n = N;
      |     ^
sorting.cpp:29:22: error: 'on' was not declared in this scope; did you mean 'yn'?
   29 |     FOR(i, 0, n - 1) on[i] = S[i];
      |                      ^~
      |                      yn
sorting.cpp:30:22: error: 'x' was not declared in this scope
   30 |     FOR(i, 0, M - 1) x[i] = X[i], y[i] = Y[i];
      |                      ^
sorting.cpp:30:35: error: 'y' was not declared in this scope
   30 |     FOR(i, 0, M - 1) x[i] = X[i], y[i] = Y[i];
      |                                   ^