結果
問題 | No.496 ワープクリスタル (給料日前編) |
ユーザー | tsutaj |
提出日時 | 2017-03-24 23:20:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,622 bytes |
コンパイル時間 | 775 ms |
コンパイル使用メモリ | 88,468 KB |
最終ジャッジ日時 | 2024-11-14 19:59:46 |
合計ジャッジ時間 | 1,316 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:81:19: error: array must be initialized with a brace-enclosed initializer 81 | Edge es[55] = Edge(0, 0, 0); | ^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <iomanip> #include <cstdio> #include <string> #include <cstring> #include <deque> #include <list> #include <queue> #include <stack> #include <vector> #include <utility> #include <algorithm> #include <map> #include <set> #include <complex> #include <cmath> #include <limits> #include <cfloat> #include <climits> #include <ctime> #include <cassert> using namespace std; #define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++) #define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++) #define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--) #define all(v) begin(v), end(v) #define pb(a) push_back(a) #define fr first #define sc second #define INF 2000000000 #define int long long int #define X real() #define Y imag() #define EPS (1e-10) #define EQ(a,b) (abs((a) - (b)) < EPS) #define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) ) #define LE(n, m) ((n) < (m) + EPS) #define LEQ(n, m) ((n) <= (m) + EPS) #define GE(n, m) ((n) + EPS > (m)) #define GEQ(n, m) ((n) + EPS >= (m)) typedef vector<int> VI; typedef vector<VI> MAT; typedef pair<int, int> pii; typedef long long ll; typedef complex<double> P; typedef pair<P, P> L; typedef pair<P, double> C; int dx[]={1, -1, 0, 0}; int dy[]={0, 0, 1, -1}; int const MOD = 1000000007; ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;} int madd(int a, int b) {return (a + b) % MOD;} int msub(int a, int b) {return (a - b + MOD) % MOD;} int mmul(int a, int b) {return (a * b) % MOD;} int minv(int a) {return mod_pow(a, MOD-2);} int mdiv(int a, int b) {return mmul(a, minv(b));} namespace std { bool operator<(const P& a, const P& b) { return a.X != b.X ? a.X < b.X : a.Y < b.Y; } } struct Edge { int a, b, c; Edge(int x, int y, int z) : a(x), b(y), c(z) {} }; bool operator>(const Edge &p, const Edge &q) { return p.a != q.a ? p.a > q.a : p.b > q.b; } int mincost[110][110]; signed main() { int x, y, n, f; cin >> x >> y >> n >> f; Edge es[55] = Edge(0, 0, 0); rep(i,0,n) { int p, q, r; cin >> p >> q >> r; es[i] = Edge(p, q, r); } repq(i,0,x) repq(j,0,y) { mincost[i][j] = f * (i + j); } rep(k,0,n) { repr(i,x+y,0) { repq(p,0,i) { int q = i - p; if(p > x || q > y) continue; // printf("p = %lld, q = %lld\n", p, q); int nx = p-es[k].a, ny = q-es[k].b; if(nx < 0 || ny < 0) continue; mincost[p][q] = min(mincost[p][q], mincost[nx][ny] + es[k].c); } } } cout << mincost[x][y] << endl; return 0; }