Submission #1062603

# Submission time Handle Problem Language Result Execution time Memory
1062603 2024-08-17T09:00:21 Z ewirlan Comparing Plants (IOI20_plants) C++17
11 / 100
4000 ms 99176 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)), c(0);
    rep(rpp, 0, n){
        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;
            }
        }
        ++c;
        rep(j, 1, k)if(r[(n+a-j)%n] > 0) r[(n+a-j)%n]--;
    
        rep(j, 1, k)if(r[(n+a-j)%n] < 0)
            graf[a].pb((n+a-j)%n);
        rep(j, 1, k)if(r[(a+j)%n] < 0)
            graf[a].pb((a+j)%n);
    
        r[a] = -1;
    }
    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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 568 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 30 ms 3924 KB Output is correct
7 Runtime error 33 ms 6928 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 892 KB Output is correct
6 Correct 212 ms 9952 KB Output is correct
7 Execution timed out 4080 ms 99176 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 892 KB Output is correct
6 Correct 212 ms 9952 KB Output is correct
7 Execution timed out 4080 ms 99176 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 55 ms 12996 KB Output is correct
4 Runtime error 37 ms 8532 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 604 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 7 ms 2320 KB Output is correct
8 Correct 11 ms 2652 KB Output is correct
9 Correct 8 ms 2396 KB Output is correct
10 Correct 11 ms 2652 KB Output is correct
11 Correct 8 ms 2396 KB Output is correct
12 Correct 9 ms 2396 KB Output is correct
13 Correct 16 ms 2904 KB Output is correct
# Verdict Execution time Memory 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 44 ms 5768 KB Output is correct
6 Runtime error 45 ms 9040 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 568 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 30 ms 3924 KB Output is correct
7 Runtime error 33 ms 6928 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -