Submission #149389

# Submission time Handle Problem Language Result Execution time Memory
149389 2019-09-01T06:22:40 Z usa1+samsung2(#3703, adman, nona1314, wowoto9772) King of Chairs (FXCUP4_chairs) C++17
Compilation error
0 ms 0 KB
#include "king.h"
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
    /*
    long long ret = 0;
    vector<pair<int,int>> C_;
    for(const auto &i : C) {
        C_.emplace_back(i, 0);
    }
    for(const auto& w : W) {
        auto it = upper_bound(C_.begin(), C_.end(), pair<int,int>(w,0));
        if (it == C_.begin()) continue;
        it--;
        if ((it->first) >= w && (it->second) == 0) {
            it->second = 1;
            ret++;
        }
    }*/
    return 0LL;
}
#include <stdio.h>
#include <stdlib.h>
#include "king.h"
#include "vassal.h"

static int N, chk[101010];
static std::vector<int> W, C;

static void my_assert(int TF, const char* message){
	if(!TF){ puts(message); exit(0); }
}

int main(){
	my_assert(scanf("%d", &N) == 1, "Error: Invalid Input");
	my_assert(1 <= N && N <= 100000, "Error: Invalid Input");

	W.resize(N);
	for(int i = 0; i < N; i++){
		my_assert(scanf("%d", &W[i]) == 1, "Error: Invalid Input");
		my_assert(1 <= W[i] && W[i] <= 1000000, "Error: Invalid Input");
	}

	C.resize(N);
	for(int i = 0; i < N; i++){
		my_assert(scanf("%d", &C[i]) == 1, "Error: Invalid Input");
		my_assert(1 <= C[i] && C[i] <= 1000000, "Error: Invalid Input");
		if(i) my_assert(C[i-1] <= C[i], "Error: Invalid Input");
	}

	long long num = SendInfo(W, C);
	my_assert(0 <= num && num < (1ll << 60), "Wrong[1] : Invalid Number");

	int chair_cnt = 0;
	Init(num, C);
	for(int i = 0; i < N; i++){
		int ci = Maid(W[i]);
		my_assert(-1 <= ci && ci < N, "Wrong[2] : Invalid Chair Number");
		my_assert(-1 == ci || !chk[ci], "Wrong[2] : Invalid Chair Number");
		my_assert(-1 == ci || W[i] <= C[ci], "Wrong[2] : Invalid Chair");
		chk[ci] = 1;
		if(ci>=0) chair_cnt++;
	}

	printf("Correct\n%d\n", chair_cnt);
	return 0;
}

Compilation message

/tmp/cc7s1SM2.o: In function `main':
grader_v.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccTqcRDC.o:vassal.cpp:(.text.startup+0x0): first defined here
/tmp/ccTqcRDC.o: In function `main':
vassal.cpp:(.text.startup+0x14c): undefined reference to `SendInfo(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
vassal.cpp:(.text.startup+0x19b): undefined reference to `Init(long long, std::vector<int, std::allocator<int> >)'
vassal.cpp:(.text.startup+0x218): undefined reference to `Maid(int)'
/tmp/cc7s1SM2.o: In function `main':
grader_v.cpp:(.text.startup+0x1b7): undefined reference to `Init(long long, std::vector<int, std::allocator<int> >)'
grader_v.cpp:(.text.startup+0x22d): undefined reference to `Maid(int)'
collect2: error: ld returned 1 exit status