Submission #983746

# Submission time Handle Problem Language Result Execution time Memory
983746 2024-05-16T03:36:23 Z wood Werewolf (IOI18_werewolf) C++17
0 / 100
97 ms 9740 KB
#include <bits/stdc++.h>  
using namespace std;
 
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vi vector<int>
#define vp32 vector<p32>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//never guess
//never debug without reviewing code
//never try adding ones or substracting them
//only step by step debug when necessay

//the only time I thought this could be solved wihtout segment trees segment tree was the answer fml
constexpr int N = 1e2; //change

// struct segtree
// {
//     int mx[N] = {0}, mn[N], size = 1;
//     segtree(int n){while(size<=n)size*=2; fill(mn,mn+N,INT_MAX);}
//     void upd(int i, int u){
//         upd(i,u,0,0,size);
//     }
//     void upd(int i, int u, int x, int l, int r){
//         if(r-l==1){
//             mx[x] = u;
//             mn[x] = u;
//             return;
//         }
//         int m = (r+l)/2;
//         if(i<m) upd(i,u,2*x+1,l,m);
//         else upd(i,u,2*x+2,m,r);
//         mx[x] = max(mx[2*x+1],mx[2*x+2]);
//         mn[x] = min(mn[2*x+1],mn[2*x+2]);
//     }
//     int get(int l, int r, bool MX){
//         return get(l,r,0,0,size,MX);
//     }
//     int get(int l, int r, int x, int lx, int rx, bool MX){
//         int* arr = (MX) ? mx : mn;
//         if(lx>=r||rx<=l) return (MX) ? 0 : INT_MAX;
//         else if(lx>=l&&rx<=r) return arr[x];
//         int m = (rx+lx)/2;
//         int p = get(l,r,2*x+1,lx,m,MX);
//         int q = get(l,r,2*x+2,m,rx,MX);
//         if(MX) return max(p,q);
//         else return min(p,q);
//     }
// };

vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R){
    // int n = N,m = X.size(),q = S.size();
    // vi adj[n];
    // for (size_t i = 0; i < m; i++)
    // {
    //     adj[X[i]-1].pb(Y[i]-1);
    //     adj[Y[i]-1].pb(X[i]-1);
    // }
    // vi arr;
    // for (size_t i = 0; i < N; i++)
    // {
    //     if(adj[i].size()==1){
    //         int e = -1,x = i ;
    //         while(arr.size()<N){
    //             arr.pb(x);
    //             for(int p : adj[x]){
    //                 if(p!=e){
    //                     e = x;
    //                     x = p;
    //                     break;
    //                 }
    //             }
    //         }
    //         break;
    //     }
    // }
    // segtree sg(n);
    // int ind[n];
    // for (size_t i = 0; i < n; i++)
    // {
    //     sg.upd(i,arr[i]);
    //     ind[arr[i]] = i;
    // }
    vi res;
    // for (size_t i = 0; i < q; i++)
    // {
    //     int from_start;
    //     if(S[i]>R[i]||E[i]<L[i]){
    //         res.pb(0);
    //         continue;
    //     }
    //     int s = ind[S[i]-1], e = ind[E[i]-1];
    //     //binary search segtree to get the range from start
    //     //and find the furthest index whose min is smaller than R
    //     if(s>e){
    //         int r = s, l = e;
    //         while(r-l>1){
    //             int mid = (r+l)/2;
    //             if(sg.get(mid,s+1,true)<R[i]) r = mid;
    //             else l = mid;
    //         }
    //         if(arr[r]<L[i]-1||sg.get(e,l,false)<L[i]-1)
    //             res.pb(0);
    //         else res.pb(1);
    //     }
    //     else{
    //         int l = s, r = e;
    //         while(r-l>1){
    //             int mid = (r+l)/2;
    //             if(sg.get(s,mid+1,true)<R[i]) l = mid;
    //             else r = mid;
    //         }
    //         if(arr[l]<L[i]-1||sg.get(r,e+1,false)<L[i]-1)
    //             res.pb(0);
    //         else res.pb(1);
    //     }
    // }
    
    return res;
}

// int main()
// {
//     fast_cin();
//     #ifndef ONLINE_JUDGE
//         #ifdef _WIN32
//             freopen("input.in", "r", stdin);
//             freopen("input.out", "w", stdout);
//         #endif
//     #endif
//     for(int i : check_validity(5,{2,1,4,5},{1,4,5,3},{2},{3},{1},{1})) cout<<i<<' ';
//     return 0;
// }
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 97 ms 9740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -