Submission #24371

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
243712017-06-06 05:58:48jiaqiyangAbduction 2 (JOI17_abduction2)C++14
100 / 100
2566 ms266808 KiB
#include <cstdio>
#include <cstring>
#include <map>
#include <tuple>
typedef long long i64;
const int N = 50000 + 10;
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
int n, m, a[N], b[N];
int f[4][20][N];
int init() {
int q;
scanf("%d%d%d", &n, &m, &q);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
memset(f, 0x3f, sizeof f);
for (int i = 1; i <= n; ++i) f[0][0][i] = f[2][0][i] = a[i];
for (int i = 1; i <= m; ++i) f[1][0][i] = f[3][0][i] = b[i];
for (int i = 1; i < 20; ++i) {
for (int j = (1 << (i - 1)); j <= n; ++j) f[0][i][j] = std::max(f[0][i - 1][j], f[0][i - 1][j - (1 << (i - 1))]);
for (int j = (1 << (i - 1)); j <= m; ++j) f[3][i][j] = std::max(f[3][i - 1][j], f[3][i - 1][j - (1 << (i - 1))]);
for (int j = m - (1 << (i - 1)); j > 0; --j) f[1][i][j] = std::max(f[1][i - 1][j], f[1][i - 1][j + (1 << (i - 1))]);
for (int j = n - (1 << (i - 1)); j > 0; --j) f[2][i][j] = std::max(f[2][i - 1][j], f[2][i - 1][j + (1 << (i - 1))]);
}
return q;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

abduction2.cpp: In function 'int init()':
abduction2.cpp:16:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &n, &m, &q);
                              ^
abduction2.cpp:17:50: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
                                                  ^
abduction2.cpp:18:50: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
                                                  ^
abduction2.cpp: In function 'int main()':
abduction2.cpp:53:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &x, &y);
                          ^
#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...