Submission #1202341

#TimeUsernameProblemLanguageResultExecution timeMemory
1202341Kavelmydex육각형 영역 (APIO21_hexagon)C++20
Compilation error
0 ms0 KiB
/* I: 1. The path does not conatin layers = Must compute: 1. the number of cells in the territory. ====================== ====================== 3 1 1 1 1 3 1 5 1 ans: 3 + 2*1 = 5 3 1 2 1 1 3 1 5 1 ans: 7 */ #include "hexagon.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define pi pair<int,int> #define pb push_back #define sz(x) ((int)x.size()) #define sp ' ' #define endl "\n" #define all(x) (x).begin(),(x).end() #define rep(i,x,n) for(int i=x; i<=n; ++i) #define For(i,n) rep(i,0,n-1) #define ff first #define ss second #define ld long double #define mp make_pair const ll mxN=6e5+10,OO=2e9,mod=1e9+7; ll exp(ll b,ll p){ ll res=1; while(p>0){ if(p&1)res=res*b%mod; b=b*b%mod; p/=2; } return res; } const ll inv=exp(6,mod-2); const int dx[]{0,0,-1,1}, dy[]{1,-1,0,0}; void cmn(int &a,int b){a = min(a,b);} void cmx(int &a,int b){a = max(a,b);} int draw_territory(int N, int A, int B,vi D, vi L){ sort(all(D)); ll v=max(L[0],L[1]),ans=0,c=v+1, a=A,b=B; if(N==3){ assert(D==(vi){1,3,5} || D==(vi){2,4,6}); assert(L[2]<=v); } c = c * (c+1)/2; ans = c * a % mod; if(B){ // c= v*(v+1)*(2*v+1)/6; c = (v*(v+1)%mod) * (2*v+1) % mod * inv % mod; c += v*(v+1)/2; c%=mod; ans += c*b % mod; ans %=mod; } return ans; }

Compilation message (stderr)

hexagon.cpp:57:44: error: macro "assert" passed 5 arguments, but takes just 1
   57 |     assert(D==(vi){1,3,5} || D==(vi){2,4,6});
      |                                            ^
In file included from /usr/include/c++/11/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from hexagon.cpp:20:
/usr/include/assert.h:92: note: macro "assert" defined here
   92 | #  define assert(expr)                                                  \
      | 
hexagon.cpp: In function 'int draw_territory(int, int, int, std::vector<int>, std::vector<int>)':
hexagon.cpp:57:5: error: 'assert' was not declared in this scope
   57 |     assert(D==(vi){1,3,5} || D==(vi){2,4,6});
      |     ^~~~~~
hexagon.cpp:21:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
   20 | #include <bits/stdc++.h>
  +++ |+#include <cassert>
   21 | using namespace std;