Submission #1062581

# Submission time Handle Problem Language Result Execution time Memory
1062581 2024-08-17T08:51:39 Z ewirlan Comparing Plants (IOI20_plants) C++17
11 / 100
4000 ms 124680 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;
int rnk[maxn];
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);
    int rn(0);
    while(c < n){
        ++rn;
        vector <int> v;
        rep(i, 0, n)if(r[i] == 0){
            bool b(1);
            rep(j, 1, k)b &= !!r[(n+i-j)%n];
            if(b)v.pb(i);
        }
        c += sz(v);
        for(auto i: v)rnk[i] = rn;
        for(auto i: v)rep(j, 1, k)if(r[(n+i-j)%n] > 0) r[(n+i-j)%n]--;

        for(auto i: v)rep(j, 1, k)if(r[(n+i-j)%n] >= 0)
            graf[(n+i-j)%n].pb(i);
        for(auto i: v)rep(j, 1, k)if(r[(i+j)%n] >= 0)
            graf[(i+j)%n].pb(i);

        for(auto i: v)r[i] = -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 352 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 352 KB Output is correct
6 Correct 30 ms 4388 KB Output is correct
7 Runtime error 27 ms 7948 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 352 KB Output is correct
3 Correct 1 ms 356 KB Output is correct
4 Correct 0 ms 356 KB Output is correct
5 Correct 1 ms 864 KB Output is correct
6 Correct 389 ms 11192 KB Output is correct
7 Execution timed out 4061 ms 124680 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 352 KB Output is correct
3 Correct 1 ms 356 KB Output is correct
4 Correct 0 ms 356 KB Output is correct
5 Correct 1 ms 864 KB Output is correct
6 Correct 389 ms 11192 KB Output is correct
7 Execution timed out 4061 ms 124680 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 604 KB Output is correct
3 Correct 59 ms 14652 KB Output is correct
4 Runtime error 41 ms 11604 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 568 KB Output is correct
3 Correct 0 ms 560 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 10 ms 2696 KB Output is correct
8 Correct 13 ms 2908 KB Output is correct
9 Correct 9 ms 2700 KB Output is correct
10 Correct 14 ms 3004 KB Output is correct
11 Correct 8 ms 2648 KB Output is correct
12 Correct 11 ms 2660 KB Output is correct
13 Correct 23 ms 3396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 37 ms 5972 KB Output is correct
6 Runtime error 34 ms 10956 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 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 352 KB Output is correct
6 Correct 30 ms 4388 KB Output is correct
7 Runtime error 27 ms 7948 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -