제출 #399125

#제출 시각아이디문제언어결과실행 시간메모리
399125ACmachine웜뱃 (IOI13_wombats)C++17
55 / 100
20087 ms26120 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T, typename U> using ordered_map = tree<T, U, less<T>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; #define FOR(i,j,k,in) for(int i=(j); i < (k);i+=in) #define FORD(i,j,k,in) for(int i=(j); i >=(k);i-=in) #define REP(i,b) FOR(i,0,b,1) #define REPD(i,b) FORD(i,b,0,1) #define pb push_back #define mp make_pair #define ff first #define ss second #define all(x) begin(x), end(x) #define MANY_TESTS int tcase; cin >> tcase; while(tcase--) const double EPS = 1e-9; const int MOD = 1e9+7; const ll INFF = 1e18; const int INF = 1e9; const ld PI = acos((ld)-1); const vi dy = {1, 0, -1, 0, -1, 1, 1, -1}; const vi dx = {0, 1, 0, -1, -1, 1, -1, 1}; void DBG(){cout << "]" << endl;} template<typename T, typename ...U> void DBG(const T& head, const U... args){ cout << head << "; "; DBG(args...); } #define dbg(...) cout << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__); #define chk() cout << "Check at line(" << __LINE__ << ") hit." << endl; template<class T, unsigned int U> ostream& operator<<(ostream& out, const array<T, U> &v){out << "["; REP(i, U) out << v[i] << ", "; out << "]"; return out;} template <class T, class U> ostream& operator<<(ostream& out, const pair<T, U> &par) {out << "[" << par.first << ";" << par.second << "]"; return out;} template <class T> ostream& operator<<(ostream& out, const set<T> &cont) { out << "{"; for( const auto &x:cont) out << x << ", "; out << "}"; return out; } template <class T, class U> ostream& operator<<(ostream& out, const map<T, U> &cont) {out << "{"; for( const auto &x:cont) out << x << ", "; out << "}"; return out; } template<class T> ostream& operator<<(ostream& out, const vector<T> &v){ out << "["; REP(i, v.size()) out << v[i] << ", "; out << "]"; return out;} template<class T> istream& operator>>(istream& in, vector<T> &v){ for(auto &x : v) in >> x; return in; } int r, c; vector<vector<int>> v; vector<vector<int>> h; struct row{ vector<int> dp; row(){} row(vector<int> &init){ dp.resize(c); REP(i, c) dp[i] = init[i]; } void normalize(int row_id){ REP(j, dp.size()){ REP(i, dp.size()){ if(i > 0){ dp[i] = min(dp[i], dp[i - 1] + h[row_id][i - 1]); } if(i < (int)dp.size() - 1){ dp[i] = min(dp[i], dp[i + 1] + h[row_id][i]); } } } } }; row merge(row &a, row &b, int row_id){ // b je nizsie; row_id = id bcka row res = b; REP(i, a.dp.size()){ res.dp[i] += a.dp[i] + v[row_id - 1][i]; } res.normalize(row_id); return res; } //vector<row> rows; void go(row &a, int row_id){ REP(i, a.dp.size()){ a.dp[i] += v[row_id - 1][i]; } a.normalize(row_id); } void init(int R, int C, int H[5000][200], int V[5000][200]) { r = R; c = C; h.resize(r, vector<int>(c)); v.resize(r, vector<int>(c)); REP(i, r - 1){ REP(j, c){ v[i][j] = V[i][j]; } } REP(i, r){ REP(j, c - 1){ h[i][j] = H[i][j]; } } //rows.resize(r); //vector<int> init(c, 0); //REP(i, r){ //rows[i] = row(init); //} /* ... */ } void changeH(int P, int Q, int W) { h[P][Q] = W; /* ... */ } void changeV(int P, int Q, int W) { v[P][Q] = W; /* ... */ } int escape(int V1, int V2) { vector<int> f(c, INF); f[V1] = 0; row a(f); a.normalize(0); FOR(i, 1, r, 1){ go(a, i); } return a.dp[V2]; }

컴파일 시 표준 에러 (stderr) 메시지

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
wombats.cpp: In member function 'void row::normalize(int)':
wombats.cpp:20:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define FOR(i,j,k,in) for(int i=(j); i < (k);i+=in)
      |                                        ^
wombats.cpp:22:18: note: in expansion of macro 'FOR'
   22 | #define REP(i,b) FOR(i,0,b,1)
      |                  ^~~
wombats.cpp:69:9: note: in expansion of macro 'REP'
   69 |         REP(j, dp.size()){
      |         ^~~
wombats.cpp:20:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define FOR(i,j,k,in) for(int i=(j); i < (k);i+=in)
      |                                        ^
wombats.cpp:22:18: note: in expansion of macro 'FOR'
   22 | #define REP(i,b) FOR(i,0,b,1)
      |                  ^~~
wombats.cpp:70:13: note: in expansion of macro 'REP'
   70 |             REP(i, dp.size()){
      |             ^~~
wombats.cpp: In function 'row merge(row&, row&, int)':
wombats.cpp:20:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define FOR(i,j,k,in) for(int i=(j); i < (k);i+=in)
      |                                        ^
wombats.cpp:22:18: note: in expansion of macro 'FOR'
   22 | #define REP(i,b) FOR(i,0,b,1)
      |                  ^~~
wombats.cpp:83:5: note: in expansion of macro 'REP'
   83 |     REP(i, a.dp.size()){
      |     ^~~
wombats.cpp: In function 'void go(row&, int)':
wombats.cpp:20:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define FOR(i,j,k,in) for(int i=(j); i < (k);i+=in)
      |                                        ^
wombats.cpp:22:18: note: in expansion of macro 'FOR'
   22 | #define REP(i,b) FOR(i,0,b,1)
      |                  ^~~
wombats.cpp:91:5: note: in expansion of macro 'REP'
   91 |     REP(i, a.dp.size()){
      |     ^~~
#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...