제출 #980424

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9804242024-05-12 07:16:46michifiedNafta (COI15_nafta)C++17
34 / 100
1030 ms33492 KiB
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
using namespace std;
int rs, cs, lb, rb, tot;
vector<vector<int>> grid, dirs = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}, dp;
vector<map<int, pii>> intervsCol;
vector<int> intervsColtot;
vector<vector<bool>> seen;
void getInterv(int curi, int curj) {
seen[curi][curj] = true;
lb = min(lb, curj);
rb = max(rb, curj);
tot += grid[curi][curj];
int nexti, nextj;
for (auto& dir : dirs) {
nexti = curi + dir[0];
nextj = curj + dir[1];
if (nexti >= 0 and nexti < rs and nextj >= 0 and nextj < cs and not seen[nexti][nextj] and grid[nexti][nextj] != -1) getInterv(nexti, nextj);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...