Submission #737536

#TimeUsernameProblemLanguageResultExecution timeMemory
737536BoomydayGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
//
// Created by adavy on 2/11/2023.
//
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using db = double;
using str = string; // yay python!

using ii = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vii = vector<ii>;
using vpl = vector<pl>;
using vpd = vector<pd>;

#define tcT template<class T
#define tcTU tcT, class U

tcT> using V = vector<T>;
tcT, size_t SZ> using AR = array<T,SZ>;
tcT> using PR = pair<T,T>;

// pairs
#define mp make_pair
#define f first
#define s second

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define len(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pb push_back
#define eb emplace_back
#define pf push_front

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18; // not too close to LLONG_MAX
const ld PI = acos((ld)-1);
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!!


#include <stdio.h>
#include <assert.h>

struct Modular {
    int value;
    static const int MOD_value = MOD;

    Modular(long long v = 0) { value = v % MOD; if (value < 0) value += MOD;}
    Modular(long long a, long long b) : value(0){ *this += a; *this /= b;}

    Modular& operator+=(Modular const& b) {value += b.value; if (value >= MOD) value -= MOD; return *this;}
    Modular& operator-=(Modular const& b) {value -= b.value; if (value < 0) value += MOD;return *this;}
    Modular& operator*=(Modular const& b) {value = (long long)value * b.value % MOD;return *this;}

    friend Modular mexp(Modular a, long long e) {
        Modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
        return res;
    }
    friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }

    Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
    friend Modular operator+(Modular a, Modular const b) { return a += b; }
    friend Modular operator-(Modular a, Modular const b) { return a -= b; }
    friend Modular operator-(Modular const a) { return 0 - a; }
    friend Modular operator*(Modular a, Modular const b) { return a *= b; }
    friend Modular operator/(Modular a, Modular const b) { return a /= b; }
    friend std::ostream& operator<<(std::ostream& os, Modular const& a) {return os << a.value;}
    friend bool operator==(Modular const& a, Modular const& b) {return a.value == b.value;}
    friend bool operator!=(Modular const& a, Modular const& b) {return a.value != b.value;}
};
using vm = vector<Modular>;

int valid(int n, int inputSeq[])
{
    vi nums(inputSeq, inputSeq+n);
    trav(i, nums) i--;
    vi snums(nums); sort(all(snums));
    F0R(i, n-1){
        if (snums[i]==snums[i+1]) return 0;
    }
    int check = -1;
    F0R(i, n){
        if (nums[i]<n){
            check = (nums[i]-i+n)%n;
        }
    }
    if (check==-1) return 1;
    F0R(i, n){
        if (nums[i]<n) if (nums[i]!=(check+i)%n) return 0;
    }
    return 1;

}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
    return -2;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
    return -3;
}

/*

int gondolaSequence[100001];
int replacementSequence[250001];

int main()
{
    int i, n, tag;
    int nr;
    assert(scanf("%d", &tag)==1);
    assert(scanf("%d", &n)==1);
    for(i=0;i< n;i++)
        assert( scanf("%d", &gondolaSequence[i]) ==1);

    switch (tag){
        case 1: case 2: case 3:
            printf("%d\n", valid(n, gondolaSequence));
            break;

        case 4: case 5: case 6:
            nr = replacement(n, gondolaSequence, replacementSequence);
            printf("%d ", nr);
            if (nr > 0)
            {
                for (i=0; i<nr-1; i++)
                    printf("%d ", replacementSequence[i]);
                printf("%d\n", replacementSequence[nr-1]);
            }
            else printf("\n");
            break;

        case 7: case 8: case 9: case 10:
            printf("%d\n",  countReplacement(n, gondolaSequence));
            break;
    }

    return 0;
}*/

Compilation message (stderr)

/usr/bin/ld: /tmp/ccosBED0.o: in function `main':
grader.cpp:(.text.startup+0xb6): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status