Submission #975195

# Submission time Handle Problem Language Result Execution time Memory
975195 2024-05-04T14:42:13 Z yoav_s Hexagonal Territory (APIO21_hexagon) C++17
3 / 100
1 ms 604 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<vv> vvv;
typedef pair<ll, ll> p;
typedef vector<p> vp;
typedef vector<vp> vvp;
typedef vector<vvp> vvvp;
typedef pair<ll, p> tri;
typedef vector<tri> vtri;
typedef vector<vtri> vvtri;
typedef vector<vvtri> vvvtri;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vvb> vvvb;

#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()

const ll INF = 1e18;
const ll mod = 1e9 + 7;

#include "hexagon.h"

struct Hex
{
    ll a, b, c;
    Hex() {a = 0; b = 0; c = 0;}
    Hex(ll a, ll b, ll c) : a(a), b(b), c(c) {}
    Hex operator+(Hex other)
    {
        return Hex(a + other.a, b + other.b, c + other.c);
    }
    Hex operator+=(Hex other)
    {
        a += other.a; b += other.b; c += other.c;
    }
    Hex operator-(Hex other)
    {
        return Hex(a - other.a, b - other.b, c - other.c);
    }
    Hex operator-=(Hex other)
    {
        a -= other.a; b -= other.b; c -= other.c;
    }
    Hex operator-()
    {
        return Hex() - *this;
    }
};

int draw_territory(int N, int A, int B, std::vector<int> D, std::vector<int> L) {
    ll count = ((L[0] + 1ll) * (L[0] + 2ll)) / 2;
    count %= mod;
    return (A * count) % mod;
}
/*
int main() {
    int N, A, B;
    assert(3 == scanf("%d %d %d", &N, &A, &B));
    std::vector<int> D(N), L(N);
    for (int i = 0; i < N; ++i) {
        assert(2 == scanf("%d %d", &D[i], &L[i]));
    }

    int result = draw_territory(N, A, B, D, L);
    printf("%d\n", result);
    return 0;
}
/**/

Compilation message

hexagon.cpp:77:1: warning: "/*" within comment [-Wcomment]
   77 | /**/
      |  
hexagon.cpp: In member function 'Hex Hex::operator+=(Hex)':
hexagon.cpp:44:5: warning: no return statement in function returning non-void [-Wreturn-type]
   44 |     }
      |     ^
hexagon.cpp: In member function 'Hex Hex::operator-=(Hex)':
hexagon.cpp:52:5: warning: no return statement in function returning non-void [-Wreturn-type]
   52 |     }
      |     ^
# 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 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 604 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -