이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef __int128 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 length = L[0] + 1;
ll count = ((length * (length + 1)) / 2) % mod;
ll squareSum= ((((length * (length + 1))) * (2 * length + 1)) / 6) % mod;
return ((A * count) + B * (squareSum - count + mod)) % 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;
}
/**/
컴파일 시 표준 에러 (stderr) 메시지
hexagon.cpp:78:1: warning: "/*" within comment [-Wcomment]
78 | /**/
|
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |