답안 #1041773

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041773 2024-08-02T08:02:28 Z GEN(#11054) A Light Inconvenience (CEOI23_light) C++17
5 / 100
376 ms 600 KB
#include "light.h"
#include <vector>
using namespace std;
#include <bits/stdc++.h>
#define int long long

int N = 1;
vector<int> V;
void prepare(){
	N = 1;
	V.clear();
	V.push_back(1);
}

std::pair<long long, std::vector<long long>> join(long long p){
	N += p;
	vector<int> V2;
	int i, j;
	int c = N;
	while(true) {
        V2.push_back(c);
        if(c==1) break;
        c = max(1LL, 2*(c-1)-N);
	}
	reverse(V2.begin(),V2.end());
	int v = 0;
	for(int n : V2) {
        int mi = 1e17;
        for(int m : V) {
            if(m <= n) mi = min(mi, n-m);
        }
        v = max(v, mi);
	}
	V = V2;
	return {v, V};
}

std::pair<long long, std::vector<long long>> leave(long long p){
	N -= p;
	int c = N;
	vector<int> V2;
	while(true) {
        V2.push_back(c);
        if(c==1) break;
        c = max(1LL, 2*(c-1)-N);
	}
	reverse(V2.begin(),V2.end());
	int v = 0;
	for(int n : V2) {
        int mi = 1e17;
        for(int m : V) {
            if(m <= n) mi = min(mi, n-m);
        }
        v = max(v, mi);
	}
	V = V2;
	return {v, V};
}

Compilation message

light.cpp: In function 'std::pair<long long int, std::vector<long long int> > join(long long int)':
light.cpp:18:6: warning: unused variable 'i' [-Wunused-variable]
   18 |  int i, j;
      |      ^
light.cpp:18:9: warning: unused variable 'j' [-Wunused-variable]
   18 |  int i, j;
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 353 ms 600 KB Correct
3 Correct 366 ms 600 KB Correct
4 Correct 366 ms 600 KB Output is correct
5 Correct 336 ms 416 KB Correct
6 Correct 347 ms 592 KB Correct
7 Correct 376 ms 344 KB Correct
8 Correct 360 ms 416 KB Output is correct
9 Correct 342 ms 440 KB Output is correct
10 Correct 363 ms 436 KB Output is correct
11 Correct 373 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 360 ms 424 KB Correct
3 Correct 372 ms 344 KB Correct
4 Partially correct 339 ms 436 KB Partially correct
5 Correct 360 ms 344 KB Correct
6 Correct 370 ms 416 KB Correct
7 Correct 354 ms 420 KB Correct
8 Partially correct 348 ms 428 KB Partially correct
9 Partially correct 353 ms 344 KB Partially correct
10 Partially correct 366 ms 416 KB Partially correct
11 Correct 328 ms 344 KB Correct
12 Incorrect 0 ms 344 KB Not correct
13 Halted 0 ms 0 KB -