답안 #1041802

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041802 2024-08-02T08:27:03 Z 김은성(#11000) A Light Inconvenience (CEOI23_light) C++17
0 / 100
2 ms 428 KB
#include "light.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool ch;
ll cnt;
ll a[151];
void prepare(){
	ch = 0;
	cnt = 1;
	a[0] = 1;
	a[1] = 2;
	for(int i=2; i<=148; i++){
		a[i] = a[i-1] + i/2;
	}
}

std::pair<long long, std::vector<long long>> join(long long p){
	cnt += p;
	vector<ll> ret;
	for(int i=0; a[i]<=cnt; i++)
		ret.push_back(cnt+1-a[i]);
	if(ret.empty() || ret.back() != 1)
		ret.push_back(1);
	for(int i=0; i<ret.size()/2; i++)
		swap(ret[i], ret[ret.size()-1-i]);
	return make_pair(5*p, ret);
}

std::pair<long long, std::vector<long long>> leave(long long p){
	ch = 1;
	cnt -= p;
	vector<ll> ret;
	for(int i=0; a[i]<=cnt; i++)
		ret.push_back(cnt+1-a[i]);
	if(ret.empty() || ret.back() != 1)
		ret.push_back(1);
	for(int i=0; i<ret.size()/2; i++)
		swap(ret[i], ret[ret.size()-1-i]);
	return make_pair(5*p, ret);
}

Compilation message

light.cpp: In function 'std::pair<long long int, std::vector<long long int> > join(long long int)':
light.cpp:25:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  for(int i=0; i<ret.size()/2; i++)
      |               ~^~~~~~~~~~~~~
light.cpp: In function 'std::pair<long long int, std::vector<long long int> > leave(long long int)':
light.cpp:38:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(int i=0; i<ret.size()/2; i++)
      |               ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 428 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -