답안 #1062614

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1062614 2024-08-17T09:06:55 Z ewirlan 식물 비교 (IOI20_plants) C++17
25 / 100
382 ms 30068 KB
//
#ifndef __SIZEOF_INT128__
    #define __SIZEOF_INT128__
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template <typename T> using oset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define rep(i, p, k) for(int i(p); i < (k); ++i)
#define per(i, p, k) for(int i(p); i > (k); --i)
#define sz(x) (int)(x).size()
#define sc static_cast
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef __int128_t lll;
//#define int ll
template <typename T = int> using par = std::pair <T, T>;
#define fi first
#define se second
#define test int _number_of_tests(in()); while(_number_of_tests--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb emplace_back
struct Timer {
    string name{""};
    time_point<high_resolution_clock> end, start{high_resolution_clock::now()};
    duration<float, std::milli> dur;
    Timer() = default;
    Timer(string nm): name(nm) {}
    ~Timer() {
        end = high_resolution_clock::now(); dur= end - start;
        cout << "@" << name << "> " << dur.count() << " ms" << '\n';
    }
};
template <typename T = int> inline T in()
{
    static T x;
    std::cin >> x;
    return x;
}
std::string yn(bool b)
{
    if(b) return "YES\n";
    else return "NO\n";
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par);
template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector <T>& wek)
{
    for(const auto& i : wek)out << i << ' ';
    return out;
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par)
{
    out << '{'<<par.first<<", "<<par.second<<"}";
    return out;
}
#define show(x) cerr << #x << " = " << x << '\n';
#include "plants.h"
constexpr int maxn = 5003;
vector <int> graf[maxn];
bool mn[maxn][maxn];
void dfs(int p, int w){
    for(auto i: graf[w])if(!mn[p][i]){
        mn[p][i] = 1;
        dfs(p, i);
    }
}
void init(int k, vector <int> r)
{
    int n(sz(r));
    rep(c, 1, n+1){
        int a(-1);
        rep(i, 0, n)if(r[i] == 0){
            bool b(1);
            rep(j, 1, k)b &= !!r[(n+i-j)%n];
            if(b){
                a = i;
                break;
            }
        }
        rep(j, 1, k)if(r[(n+a-j)%n] > 0) r[(n+a-j)%n]--;
    
        int m(0), g;
        rep(j, 1, k)if(r[(n+a-j)%n] < m){
            m = r[(n+a-j)%n];
            g = (n+a-j)%n;
        }
        if(m) graf[a].pb(g);
        m = 0;
        rep(j, 1, k)if(r[(a+j)%n] < m){
            m = r[(a+j)%n];
            g = (a+j)%n;
        }
        if(m)graf[a].pb(g);
    
        r[a] = -c;
    }
    rep(i, 0, n)dfs(i, i);
}
int compare_plants(int x, int y)
{
    if(mn[x][y])return -1;
    if(mn[y][x])return 1;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 32 ms 3420 KB Output is correct
7 Runtime error 34 ms 5968 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 19 ms 5488 KB Output is correct
7 Correct 327 ms 27988 KB Output is correct
8 Correct 2 ms 860 KB Output is correct
9 Correct 14 ms 5536 KB Output is correct
10 Correct 333 ms 30068 KB Output is correct
11 Correct 222 ms 29524 KB Output is correct
12 Correct 223 ms 29492 KB Output is correct
13 Correct 382 ms 29932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 19 ms 5488 KB Output is correct
7 Correct 327 ms 27988 KB Output is correct
8 Correct 2 ms 860 KB Output is correct
9 Correct 14 ms 5536 KB Output is correct
10 Correct 333 ms 30068 KB Output is correct
11 Correct 222 ms 29524 KB Output is correct
12 Correct 223 ms 29492 KB Output is correct
13 Correct 382 ms 29932 KB Output is correct
14 Runtime error 29 ms 8100 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 59 ms 12904 KB Output is correct
4 Runtime error 41 ms 8528 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 9 ms 2120 KB Output is correct
8 Correct 10 ms 2396 KB Output is correct
9 Correct 8 ms 2396 KB Output is correct
10 Correct 8 ms 2396 KB Output is correct
11 Correct 8 ms 2140 KB Output is correct
12 Correct 9 ms 2376 KB Output is correct
13 Correct 9 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 8 ms 5444 KB Output is correct
6 Runtime error 47 ms 8784 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 32 ms 3420 KB Output is correct
7 Runtime error 34 ms 5968 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -