답안 #682939

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
682939 2023-01-17T10:03:23 Z Nursik 자매 도시 (APIO20_swap) C++14
7 / 100
330 ms 41528 KB
#include "swap.h"

#include <stdio.h>
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define mp make_pair
#define f first
#define s second
#define pb push_back

const int maxn = 1e6 + 200;

int subtask2 = 1;
multiset<int> setik;
vector<pair<int, int>> g[maxn];
void init(int n, int m, vector<int> u, vector<int> v, vector<int> w) {
    for (int i = 0; i < m; ++i){
        int x = u[i], y = v[i];
        g[x].pb(mp(y, w[i]));
        g[y].pb(mp(x, w[i]));
    }
    for (auto it : u){
        subtask2 &= (it == 0);
    }
    for (auto it : w){
        setik.insert(it);
    }
}

int getMinimumFuelCapacity(int x, int y) {
    if (x == 0){
        int cur = g[y][0].s;
        setik.erase(setik.find(cur));
        int sz = (int)setik.size();
        if (sz == 0){
            setik.insert(cur);
            return -1;
        }
        sz -= 1;
        int cur2 = *setik.begin();
        setik.erase(setik.find(cur2));
        if (sz == 0){
            setik.insert(cur);
            setik.insert(cur2);
            return -1;
        }
        sz -= 1;
        int cur3 = *setik.begin();
        setik.insert(cur);
        setik.insert(cur2);
        return max({cur, cur2, cur3});
    }
    int cur = g[x][0].s;
    int cur2 = g[y][0].s;
    setik.erase(setik.find(cur));
    setik.erase(setik.find(cur2));
    if ((int)setik.size() == 0){
        setik.insert(cur);
        setik.insert(cur2);
        return -1;
    }
    int cur3 = *setik.begin();
    setik.insert(cur);
    setik.insert(cur2);
    return max({cur, cur2, cur3});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 13 ms 23764 KB Output is correct
3 Correct 14 ms 23792 KB Output is correct
4 Incorrect 12 ms 23804 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 13 ms 23764 KB Output is correct
3 Correct 328 ms 37164 KB Output is correct
4 Correct 307 ms 37468 KB Output is correct
5 Correct 290 ms 37460 KB Output is correct
6 Correct 323 ms 41292 KB Output is correct
7 Correct 330 ms 41528 KB Output is correct
8 Correct 312 ms 41012 KB Output is correct
9 Correct 290 ms 41316 KB Output is correct
10 Correct 307 ms 40896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 13 ms 23764 KB Output is correct
3 Correct 14 ms 23792 KB Output is correct
4 Incorrect 12 ms 23804 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 13 ms 23764 KB Output is correct
3 Correct 14 ms 23792 KB Output is correct
4 Incorrect 12 ms 23804 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 13 ms 23764 KB Output is correct
3 Correct 14 ms 23792 KB Output is correct
4 Incorrect 12 ms 23804 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 23764 KB Output is correct
2 Correct 13 ms 23764 KB Output is correct
3 Correct 14 ms 23792 KB Output is correct
4 Incorrect 12 ms 23804 KB Output isn't correct
5 Halted 0 ms 0 KB -