제출 #1359174

#제출 시각아이디문제언어결과실행 시간메모리
1359174weedywelon선물 (IOI25_souvenirs)C++20
22 / 100
0 ms412 KiB
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <map>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#include <cassert>
#include "souvenirs.h"
#include <utility>
#define SZ(x) (LL)(x.size())
#define FR(i,a,b) for(LL i=(a);i<(b);++i)
#define FOR(i,n) FR(i,0,n)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define A first
#define B second
#define mp(a,b) make_pair(a,b)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef unsigned __int128 U128;
typedef __int128 I128;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
typedef std::pair<LD,LD> PLD;
using namespace std;

const int MAXN=101;
int cnt[MAXN];
LL p[MAXN];
int n;

void upd(vector<int> v){
	FOR(i,SZ(v)) cnt[v[i]]++;
}

void buy_souvenirs(int N, LL p0){
	n=N;
	pair<vector<int>, LL> res=transaction(p0-1);
	if (n==2) return;
	upd(res.A);
	
	if (cnt[2]>=1){
		LL sum=p0-1-res.B;
		transaction((sum-1)/2);
	}
	else{
		p[1]=p0-1-res.B;
		transaction(p[1]-1);
		transaction(p[1]-1);
	}
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…