# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
83576 | 2018-11-09T11:52:18 Z | ekrem | The Kingdom of JOIOI (JOI17_joioi) | C++ | 1386 ms | 263168 KB |
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define orta ((bas+son)/2) #define inf 1000000007 #define N 2005 using namespace std; int n, m, ans = inf, mx, mn, a[N][N]; void cevir(); void cevir2(); bool dene(int frk){ if(mx - mn <= frk) return 1; int bas = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++) if(mx - a[i][j] > frk) bas = max(bas, j + 1); for(int j = 1; j <= m; j++) if(a[i][j] - mn > frk) if(j < bas) return 0; } return 1; } void coz(){ int bas = 0; int son = inf; while(bas < son){ if(dene(orta)) son = orta; else bas = orta + 1; } // cout << orta << endl; ans = min(ans, orta); } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); mn = inf; scanf("%d %d",&n ,&m); for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++){ scanf("%d",&a[i][j]); mx = max(mx, a[i][j]); mn = min(mn, a[i][j]); } coz(); cevir(); coz(); cevir2(); coz(); cevir(); coz(); printf("%d\n", ans); return 0; } void cevir(){ for(int j = 1; j <= m; j++) for(int i = 1; i <= n/2; i++) swap(a[i][j], a[n - i + 1][j]); } void cevir2(){ for(int i = 1; i <= n; i++) reverse(a[i] + 1, a[i] + m + 1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 2 ms | 456 KB | Output is correct |
5 | Correct | 2 ms | 456 KB | Output is correct |
6 | Correct | 2 ms | 680 KB | Output is correct |
7 | Correct | 2 ms | 680 KB | Output is correct |
8 | Correct | 2 ms | 680 KB | Output is correct |
9 | Correct | 2 ms | 680 KB | Output is correct |
10 | Correct | 2 ms | 680 KB | Output is correct |
11 | Correct | 3 ms | 680 KB | Output is correct |
12 | Correct | 2 ms | 680 KB | Output is correct |
13 | Correct | 2 ms | 680 KB | Output is correct |
14 | Correct | 2 ms | 680 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 2 ms | 456 KB | Output is correct |
5 | Correct | 2 ms | 456 KB | Output is correct |
6 | Correct | 2 ms | 680 KB | Output is correct |
7 | Correct | 2 ms | 680 KB | Output is correct |
8 | Correct | 2 ms | 680 KB | Output is correct |
9 | Correct | 2 ms | 680 KB | Output is correct |
10 | Correct | 2 ms | 680 KB | Output is correct |
11 | Correct | 3 ms | 680 KB | Output is correct |
12 | Correct | 2 ms | 680 KB | Output is correct |
13 | Correct | 2 ms | 680 KB | Output is correct |
14 | Correct | 2 ms | 680 KB | Output is correct |
15 | Correct | 3 ms | 680 KB | Output is correct |
16 | Correct | 7 ms | 1664 KB | Output is correct |
17 | Correct | 12 ms | 1940 KB | Output is correct |
18 | Correct | 11 ms | 2220 KB | Output is correct |
19 | Correct | 13 ms | 2488 KB | Output is correct |
20 | Correct | 11 ms | 2696 KB | Output is correct |
21 | Correct | 15 ms | 3144 KB | Output is correct |
22 | Correct | 15 ms | 3532 KB | Output is correct |
23 | Correct | 21 ms | 4044 KB | Output is correct |
24 | Correct | 14 ms | 4176 KB | Output is correct |
25 | Correct | 20 ms | 4664 KB | Output is correct |
26 | Correct | 15 ms | 5052 KB | Output is correct |
27 | Correct | 14 ms | 5484 KB | Output is correct |
28 | Correct | 15 ms | 5872 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 2 ms | 456 KB | Output is correct |
5 | Correct | 2 ms | 456 KB | Output is correct |
6 | Correct | 2 ms | 680 KB | Output is correct |
7 | Correct | 2 ms | 680 KB | Output is correct |
8 | Correct | 2 ms | 680 KB | Output is correct |
9 | Correct | 2 ms | 680 KB | Output is correct |
10 | Correct | 2 ms | 680 KB | Output is correct |
11 | Correct | 3 ms | 680 KB | Output is correct |
12 | Correct | 2 ms | 680 KB | Output is correct |
13 | Correct | 2 ms | 680 KB | Output is correct |
14 | Correct | 2 ms | 680 KB | Output is correct |
15 | Correct | 3 ms | 680 KB | Output is correct |
16 | Correct | 7 ms | 1664 KB | Output is correct |
17 | Correct | 12 ms | 1940 KB | Output is correct |
18 | Correct | 11 ms | 2220 KB | Output is correct |
19 | Correct | 13 ms | 2488 KB | Output is correct |
20 | Correct | 11 ms | 2696 KB | Output is correct |
21 | Correct | 15 ms | 3144 KB | Output is correct |
22 | Correct | 15 ms | 3532 KB | Output is correct |
23 | Correct | 21 ms | 4044 KB | Output is correct |
24 | Correct | 14 ms | 4176 KB | Output is correct |
25 | Correct | 20 ms | 4664 KB | Output is correct |
26 | Correct | 15 ms | 5052 KB | Output is correct |
27 | Correct | 14 ms | 5484 KB | Output is correct |
28 | Correct | 15 ms | 5872 KB | Output is correct |
29 | Correct | 703 ms | 42064 KB | Output is correct |
30 | Correct | 759 ms | 64468 KB | Output is correct |
31 | Correct | 844 ms | 87524 KB | Output is correct |
32 | Correct | 704 ms | 110800 KB | Output is correct |
33 | Correct | 618 ms | 128756 KB | Output is correct |
34 | Correct | 804 ms | 153840 KB | Output is correct |
35 | Correct | 1200 ms | 192712 KB | Output is correct |
36 | Correct | 1054 ms | 226168 KB | Output is correct |
37 | Runtime error | 1386 ms | 263168 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |