제출 #975204

#제출 시각아이디문제언어결과실행 시간메모리
975204yoav_s육각형 영역 (APIO21_hexagon)C++17
9 / 100
1 ms348 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...