# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45716 | 2018-04-16T04:31:58 Z | TheDarkning | Jakarta Skyscrapers (APIO15_skyscraper) | C++17 | 35 ms | 16176 KB |
/** ▄█▀ ▀█▀ ▄▀▄ █▀ █▄█▄█ ▄▀▄ █▀ ▄█▀ <⇋⇋⇋⋛∰≓⊂(⌒,_ゝ⌒)⊃≓∰⋛⇋⇋⇋> ♔♕♖♗♘♙ ☜❷☞✪ ィℋ६ ≈ ᗫẵℜℵĬŊĞ ✪☜❷☞ ♚♛♜♝♞♟ ♔♕♖♗♘♙ ♚♛♜♝♞♟ ˙·٠•●♥ Ƹ̵̡Ӝ̵̨̄Ʒ ♥●•٠·˙ **/ #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <iomanip> #include <time.h> #include <map> #include <deque> #include <string> #include <memory.h> #include <set> #define sz(s) s.size() #define pb push_back #define fr first #define sc second #define mk make_pair #define all(s) s.begin(), s.end() using namespace std; const int N = 1e6 + 5; const int inf = 1e9 + 7; int n, m, p, b, cnt, dp[ 2000 ][ 2000 ]; main() { memset( dp, 0x3f3f3f3f, sizeof(dp) ); scanf("%d%d", &n, &m); for( int i = 1; i <= m; i++ ) { scanf("%d%d", &p, &b); p++; cnt = 0; for( int j = p; j <= n; j += b ) { dp[p][ j ] = min( dp[p][ j ], cnt ); cnt++; } cnt = 0; for( int j = p - b; j > 0; j -= b ) { cnt++; dp[p][j] = min ( dp[p][j], cnt ); } } for( int i = 1; i <= n; i++ ) { for( int j = 1; j <= n; j++ ) { for( int k = 1; k <= n; k++ ) dp[i][j] = min( dp[i][j], dp[i][k] + dp[k][j] ); } } cout << dp[1][2]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 15992 KB | Output is correct |
2 | Incorrect | 15 ms | 16068 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 16176 KB | Output is correct |
2 | Incorrect | 13 ms | 16176 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 16176 KB | Output is correct |
2 | Incorrect | 13 ms | 16176 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 16176 KB | Output is correct |
2 | Incorrect | 13 ms | 16176 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 16176 KB | Output is correct |
2 | Incorrect | 35 ms | 16176 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |