Submission #526902

#TimeUsernameProblemLanguageResultExecution timeMemory
526902eecsSandcastle 2 (JOI22_ho_t5)C++17
9 / 100
13 ms868 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 50010; int h, w, a[maxn]; long long ans; int id(int x, int y) { return (x - 1) * w + y; } int main() { scanf("%d %d", &h, &w); for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { scanf("%d", &a[id(i, j)]); } } if (h == 1) { static int f[maxn], id[maxn]; fill(f + 1, f + w + 1, 1); iota(id + 1, id + w + 1, 1); sort(id + 1, id + w + 1, [&](int x, int y) { return a[x] < a[y]; }); for (int i = 1; i <= w; i++) { int x = id[i]; if (x > 1 && a[x - 1] < a[x]) f[x] += f[x - 1]; if (x < w && a[x + 1] < a[x]) f[x] += f[x + 1]; } printf("%lld\n", accumulate(f + 1, f + w + 1, 0LL)), exit(0); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d", &h, &w);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             scanf("%d", &a[id(i, j)]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~
#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...