Submission #529473

#TimeUsernameProblemLanguageResultExecution timeMemory
529473fhvirusSandcastle 2 (JOI22_ho_t5)C++17
10 / 100
5093 ms852 KiB
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef pair<int, int> pii; #define pb emplace_back #define AI(x) begin(x),end(x) #define ff first #define ss second #ifdef OWO #define debug(args...) LKJ("\033[0;32m[ " + string(#args) + " ]\033[0m", args) template<class I> void LKJ(I&&x) { cerr << x << endl; } template<class I, class...T> void LKJ(I&&x, T&&...t) { cerr << x << ", "; LKJ(t...); } template<class I> void OI(I a, I b) { while (a < b) cerr << *a << " \n"[next(a) == b]; } #else #define debug(...) 0 #define OI(...) 0 #endif bool next_to(pii a, pii b) { int da = a.ff - b.ff; int db = a.ss - b.ss; if (da < 0) da = -da; if (db < 0) db = -db; return (da + db == 1); } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int H, W; cin >> H >> W; vector<vector<int>> A(H, vector<int>(W)); for (auto &v: A) for (int &i: v) cin >> i; int ans = 0; map<int, pii> mp; for (int u = 0; u < H; ++u) for (int l = 0; l < W; ++l) { for (int r = l; r < W; ++r) { mp.clear(); for (int d = u; d < H; ++d) { debug(u, l, r, d); for (int p = l; p <= r; ++p) mp[A[d][p]] = pii(d, p); bool all = true; for (auto it = begin(mp); it != end(mp) and all; ++it) { all &= (it == begin(mp) or next_to(it->ss, prev(it)->ss)); all &= (it == prev(end(mp)) or next_to(it->ss, next(it)->ss)); } ans += all; } } } cout << ans << '\n'; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
Main.cpp:41:6: note: in expansion of macro 'debug'
   41 |      debug(u, l, r, d);
      |      ^~~~~
#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...