Submission #618014

# Submission time Handle Problem Language Result Execution time Memory
618014 2022-08-01T19:07:39 Z MohamedAliSaidane Hexagonal Territory (APIO21_hexagon) C++14
9 / 100
1 ms 420 KB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include "hexagon.h"
        using namespace __gnu_pbds;
        using namespace std;

        typedef tree<int,null_type,less<int>,rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;

        typedef long long ll;
        typedef long double ld;

        //#define int ll

        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef pair<ld,ld> pld;

        typedef vector<int> vi;
        typedef vector<ll> vll;
        typedef vector<pii> vpi;
        typedef vector<pll> vpl;

        #define pb push_back
        #define popb pop_back
        #define pp pop_back
        #define pf push_front
        #define popf pop_front
        #define all(x) (x).begin(),(x).end()
        #define ff first
        #define ss second



        int nx[4] = {0,0,1,-1}, ny[4] = {1,-1,0,0};
        ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;}
        ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);}


        const ll MOD =   1e9 + 7;
        ll mod(ll x, ll m = MOD){return (x + m)%m;}

        ll binpow(ll a, ll b, ll m = MOD)
        {
            a = a % m;
            ll rep = 1ll;
            while(b)
            {
                if(b & 1)
                    rep = rep * a % m;
                b /= 2ll;
                a = a * a % m;
            }
            return rep;
        }
        ll inv(ll x, ll m = MOD)
        {
            return binpow(x, m - 2ll, m);
        }
        int draw_territory(int N, int A, int B, vi D, vi L )
        {
            ll lng = L[0] + 1ll;
            ll dunp = mod(A * mod(mod(lng * (lng + 1ll)) * inv(2ll)));
            ll dautp = mod(mod(mod(lng * (lng + 1ll)) * (2ll * lng + 1ll)) * inv(6ll));
            dautp = mod(dautp - mod(mod(lng * (lng + 1ll)) * inv(2ll)));
            dautp = mod(dautp * 1ll * B);
            return mod(dunp + dautp);
        }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 420 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 296 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -