buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PRINT(a) cout << (a) << endl #define pb push_back #define eb emplace_back #define mp make_pair #defin...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PRINT(a) cout << (a) << endl #define pb push_back #define eb emplace_back #define mp make_pair #defin...
[["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
686
#include <bits/stdc++.h> using namespace std; #define INF 12345678 int main() { ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; int ch, cw, dh, dw; cin >> ch >> cw >> dh >> dw; ch--; cw--; dh--; dw--; vector<vector<char>> s(h, vector<char>(w)); for (int i = 0; i < h; i++) { ...
#include <bits/stdc++.h> using namespace std; #define INF 12345678 int main() { ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; int ch, cw, dh, dw; cin >> ch >> cw >> dh >> dw; ch--; cw--; dh--; dw--; vector<vector<char>> s(h, vector<char>(w)); for (int i = 0; i < h; i++) { ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
479
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define RALL(x) x.rbegin(), x.rend() #define MP make_pair #define PB push_back #define X first #define Y second typedef long long int lld; typedef pair<int, int> pii; typedef pair<lld, lld> pll; const int maxn = (int)1e3 + 5; const int ...
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define RALL(x) x.rbegin(), x.rend() #define MP make_pair #define PB push_back #define X first #define Y second typedef long long int lld; typedef pair<int, int> pii; typedef pair<lld, lld> pll; const int maxn = (int)1e3 + 5; const int ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
583
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; #define FOR(i, a, b) for (int i = a; i < b; ++i) #define FORR(i, a, b) for (int i = b - 1; i >= a; --i) #define REP(i, n) FOR(i, 0, n) #define REPR(i, n) FORR(i, 0,...
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; #define FOR(i, a, b) for (int i = a; i < b; ++i) #define FORR(i, a, b) for (int i = b - 1; i >= a; --i) #define REP(i, n) FOR(i, 0, n) #define REPR(i, n) FORR(i, 0,...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
722
#include <bits/stdc++.h> using namespace std; typedef long long ll; char s[1010][1010]; ll dis[1010][1010]; bool f[1010][1010]; int main() { ll h, w, sy, sx, gy, gx; cin >> h >> w >> sy >> sx >> gy >> gx; for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) { cin >> s[i][j]; dis[i][j] = 1e9; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; char s[1010][1010]; ll dis[1010][1010]; bool f[1010][1010]; int main() { ll h, w, sy, sx, gy, gx; cin >> h >> w >> sy >> sx >> gy >> gx; for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) { cin >> s[i][j]; dis[i][j] = 1e9; ...
[["-", 31, 69, 341, 342, 0, 16, 12, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 16, 12, 69, 28, 22], ["-", 12, 69, 341, 342, 0, 16, 12, 69, 28, 22], ["+", 12, 69, 341, 342, 0, 16, 12, 69, 28, 22], ["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
592
import collections, itertools H, W, ch, cw, dh, dw, *S = open(0).read().split() H, W, ch, cw, dh, dw = [int(_) + 1 for _ in [H, W, ch, cw, dh, dw]] H += 3 W += 3 S = ['#' * W] + ['#' * W] + ['##' + s + '##' for s in S] + ['#' * W] + ['#' * W] Dist = [[None] * W for _ in range(H)] Q = collec...
import collections, itertools H, W, ch, cw, dh, dw, *S = open(0).read().split() H, W, ch, cw, dh, dw = [int(_) + 1 for _ in [H, W, ch, cw, dh, dw]] H += 3 W += 3 S = ['#' * W] + ['#' * W] + ['##' + s + '##' for s in S] + ['#' * W] + ['#' * W] Dist = [[None] * W for _ in range(H)] Q = collec...
[["-", 15, 679, 12, 666, 0, 206, 51, 206, 206, 22], ["+", 15, 679, 12, 666, 0, 206, 51, 206, 206, 22], ["-", 0, 57, 15, 679, 12, 666, 0, 206, 206, 22], ["+", 0, 57, 15, 679, 12, 666, 0, 206, 206, 22]]
5
406
#include <bits/stdc++.h> // tabaicho see https://boostjp.github.io/tips/multiprec-int.html // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; // cpp_int // int128_t // int256_t // int512_t // int1024_t // uint128_t // uint256_t // uint512_t // uint1024_t #define int long long ...
#include <bits/stdc++.h> // tabaicho see https://boostjp.github.io/tips/multiprec-int.html // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; // cpp_int // int128_t // int256_t // int512_t // int1024_t // uint128_t // uint256_t // uint512_t // uint1024_t #define int long long ...
[["+", 0, 2, 3, 4, 0, 191, 51, 83, 0, 13], ["+", 0, 2, 3, 4, 0, 191, 51, 83, 0, 21], ["-", 0, 2, 3, 4, 0, 191, 51, 83, 0, 21], ["-", 0, 2, 3, 4, 0, 191, 51, 83, 0, 13]]
1
2,466
#include <bits/stdc++.h> using namespace std; int H, W, sx, sy, gx, gy, d[1000][1000]; string s[1000]; main() { cin >> H >> W; cin >> sx >> sy; cin >> gx >> gy; --sx; --sy; --gx; --gy; for (int i = 0; i < H; ++i) cin >> s[i]; for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) d[i][j...
#include <bits/stdc++.h> using namespace std; int H, W, sx, sy, gx, gy, d[1000][1000]; string s[1000]; main() { cin >> H >> W; cin >> sx >> sy; cin >> gx >> gy; --sx; --sy; --gx; --gy; for (int i = 0; i < H; ++i) cin >> s[i]; for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) d[i][j...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
413
#include <bits/stdc++.h> using namespace std; int H, W, sx, sy, gx, gy; string s[1000]; int d[1000][1000]; int INF = 1 << 30; main() { cin >> H >> W; cin >> sx >> sy; cin >> gx >> gy; --sx; --sy; --gx; --gy; for (int i = 0; i < H; ++i) cin >> s[i]; for (int i = 0; i < H; ++i) for (int j = 0; j...
#include <bits/stdc++.h> using namespace std; int H, W, sx, sy, gx, gy; string s[1000]; int d[1000][1000]; int INF = 1 << 30; main() { cin >> H >> W; cin >> sx >> sy; cin >> gx >> gy; --sx; --sy; --gx; --gy; for (int i = 0; i < H; ++i) cin >> s[i]; for (int i = 0; i < H; ++i) for (int j = 0; j...
[["-", 31, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
427
#include <bits/stdc++.h> using namespace std; #define int long long #define forn(i, a, n) for (int i = a; i < n; i++) int n, m; int stx, sty, edx, edy; const int INF = 1e9; char c[1001][1001]; int d[1001][1001]; char vis[1001][1001]; int dx[] = {0, 0, -1, 1}; int dy[] = {-1, 1, 0, 0}; deque<int> q; signed main() { ...
#include <bits/stdc++.h> using namespace std; #define int long long #define forn(i, a, n) for (int i = a; i < n; i++) int n, m; int stx, sty, edx, edy; const int INF = 1e9; char c[1001][1001]; int d[1001][1001]; char vis[1001][1001]; int dx[] = {0, 0, -1, 1}; int dy[] = {-1, 1, 0, 0}; deque<int> q; signed main() { ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
550
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; const int MOD = 1000000009; const long long INF = 1LL << 60; int main() { int H, W; cin >> H >> W; pint s; cin >> s.first >>...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; const int MOD = 1000000009; const long long INF = 1LL << 60; int main() { int H, W; cin >> H >> W; pint s; cin >> s.first >>...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
530
#include <bits/stdc++.h> #define f(i, a, b, c) for (int i = a; i < b; i += c) #define fr(i, a, b, c) for (int i = a; i >= b; i -= c) #define fit(it, v) for (auto it = v.begin(); it != v.end(); ++it) #define frit(it, v) for (auto it = v.rbegin(); it != v.rend(); ++it) #define all(v) v.begin(), v.end() #define allr(v) v...
#include <bits/stdc++.h> #define f(i, a, b, c) for (int i = a; i < b; i += c) #define fr(i, a, b, c) for (int i = a; i >= b; i -= c) #define fit(it, v) for (auto it = v.begin(); it != v.end(); ++it) #define frit(it, v) for (auto it = v.rbegin(); it != v.rend(); ++it) #define all(v) v.begin(), v.end() #define allr(v) v...
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
1
668
#include <bits/stdc++.h> #define pr pair<int, int> using namespace std; const int N = 1005; int n, m; int nx, my, dx, dy; char a[N][N]; int d[N][N]; int ox[4] = {0, 1, 0, -1}; int oy[4] = {-1, 0, 1, 0}; bool ok(int x, int y) { if (x >= 1 && x <= n && y >= 1 && y <= m && a[x][y] != '#') { return true; } return...
#include <bits/stdc++.h> #define pr pair<int, int> using namespace std; const int N = 1005; int n, m; int nx, my, dx, dy; char a[N][N]; int d[N][N]; int ox[4] = {0, 1, 0, -1}; int oy[4] = {-1, 0, 1, 0}; bool ok(int x, int y) { if (x >= 1 && x <= n && y >= 1 && y <= m && a[x][y] != '#') { return true; } return...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
636
/* ########################### # Author : Pranay Garg # # College : SGSITS # ########################### */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll long long int #define ull unsigned long long int #define ironman ...
/* ########################### # Author : Pranay Garg # # College : SGSITS # ########################### */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll long long int #define ull unsigned long long int #define ironman ...
[["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 13], ["+", 12, 69, 341, 342, 0, 69, 341, 342, 0, 13], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22]]
1
2,127
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #incl...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #incl...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 31, 22]]
1
3,058
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = long long; using db = double; ///***************************************************** CONSTANTS ///******************************************************//...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = long long; using db = double; ///***************************************************** CONSTANTS ///******************************************************//...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
1,044
#include <algorithm> #include <cstring> #include <iostream> #include <queue> using namespace std; const int inf = 0x3f3f3f3f; typedef pair<int, int> pii; int G[1005][1005]; int cost[1005][1005]; int n, m; int stx, sty, edx, edy; int op[4][2] = {{0, 1}, {0, -1}, {-1, 0}, {1, 0}}; void show(void) { for (int i = 1; i <...
#include <algorithm> #include <cstring> #include <iostream> #include <queue> using namespace std; const int inf = 0x3f3f3f3f; typedef pair<int, int> pii; int G[1005][1005]; int cost[1005][1005]; int n, m; int stx, sty, edx, edy; int op[4][2] = {{0, 1}, {0, -1}, {-1, 0}, {1, 0}}; void show(void) { for (int i = 1; i <...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
670
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
698
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define len(x) (ll)(x).length() using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; int main() { int h, w; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define len(x) (ll)(x).length() using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; int main() { int h, w; ...
[["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
491
#include <bits/stdc++.h> // This will work only for g++ compiler. #include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure using namespace __gnu_pbds; // Only for g++ compiler using namespace std; #define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing #de...
#include <bits/stdc++.h> // This will work only for g++ compiler. #include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure using namespace __gnu_pbds; // Only for g++ compiler using namespace std; #define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing #de...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
843
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 49, 53, 54, 55, 0, 56, 49, 84, 0, 48], ["-", 49, 53, 54, 55, 0, 56, 49, 84, 49, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
2,697
#include <iostream> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, 1, 0, -1}; const int INF = 1e9; int main() { int h, w; cin >> h >> w; int si, sj; cin...
#include <iostream> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1e9; int main() { int h, w; cin >> h >> w; int si, sj; cin...
[["-", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ...
1
501
#include <cmath> #include <iostream> #include <queue> using namespace std; bool is_integer(double x) { return floor(x) == ceil(x); } class Move { public: int w; int h; int warp; }; int main() { int h, w; int ch, cw, dh, dw; char s[1001][1001] = {'#'}; cin >> h >> w >> ch >> cw >> dh >> dw; for (int i = ...
#include <cmath> #include <iostream> #include <queue> using namespace std; bool is_integer(double x) { return floor(x) == ceil(x); } class Move { public: int w; int h; int warp; }; int main() { int h, w; int ch, cw, dh, dw; char s[1001][1001] = {'#'}; cin >> h >> w >> ch >> cw >> dh >> dw; for (int i = ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
561
#include <bits/stdc++.h> #define pb push_back typedef long long ll; using namespace std; int main() { int h, w; cin >> h >> w; int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2; char arr[h + 1][w + 1]; int level[h + 1][w + 1]; for (int i = 1; i <= h; ++i) for (int j = 1; j <= w; ++j) cin >> arr[i]...
#include <bits/stdc++.h> #define pb push_back typedef long long ll; using namespace std; int main() { int h, w; cin >> h >> w; int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2; char arr[h + 1][w + 1]; int level[h + 1][w + 1]; for (int i = 1; i <= h; ++i) for (int j = 1; j <= w; ++j) cin >> arr[i]...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
487
#include <bits/stdc++.h> #include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, 1, 0, -1}; int main() { int h, w; cin >> h >> w; int ch, cw; cin >> ch >> cw; int dh, dw; cin...
#include <bits/stdc++.h> #include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, 1, 0, -1}; int main() { int h, w; cin >> h >> w; int ch, cw; cin >> ch >> cw; int dh, dw; cin...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
483
#if loc || local #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); ++i) using ll = int_fast64_t; using pll = pair<ll, ll>; constexpr ll INF = 1LL << 60; constexpr ll MOD = 1e9 + 7; template <class T> bool chmax(T &a, const T &b) { if (a < b) { ...
#if loc || local #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); ++i) using ll = int_fast64_t; using pll = pair<ll, ll>; constexpr ll INF = 1LL << 60; constexpr ll MOD = 1e9 + 7; template <class T> bool chmax(T &a, const T &b) { if (a < b) { ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
1,108
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = int; const ll MOD = 1000000007; // const ll MOD=998244353; const long long INF = 1 << 30; const double pi = acos(-1.0); template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = int; const ll MOD = 1000000007; // const ll MOD=998244353; const long long INF = 1 << 30; const double pi = acos(-1.0); template <class T> inline bool chmin(T &a, T b) { if (a > b) {...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22]]
1
884
#include <cstdio> #include <cstring> #include <iostream> #include <queue> using namespace std; int a[1010][1010], f[1010][1010], u[4] = {-1, 1, 0, 0}, v[4] = {0, 0, 1, -1}; deque<pair<int, int>> q; int n, m, x1, y1, x2, y2; char s; int main() { int i, j, t1, t2, x0, y0; cin >> n >> m; memset(f, 10, sizeof(f)); ...
#include <cstdio> #include <cstring> #include <iostream> #include <queue> using namespace std; int a[1010][1010], f[1010][1010], u[4] = {-1, 1, 0, 0}, v[4] = {0, 0, 1, -1}; deque<pair<int, int>> q; int n, m, x1, y1, x2, y2; char s; int main() { int i, j, t1, t2, x0, y0; cin >> n >> m; memset(f, 10, sizeof(f)); ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
520
from collections import deque h, w = map(int, input().split()) ch, cw = map(lambda x: int(x)-1, input().split()) dh, dw = map(lambda x: int(x)-1, input().split()) maze = [input() for _ in range(h)] INF = float('inf') path = [[INF] * w for _ in range(h)] #ここに各マスの移動コストを記録する walk = [(1,0), (0,1), (-1,0), (0,-1)] #ワープしな...
from collections import deque h, w = map(int, input().split()) ch, cw = map(lambda x: int(x)-1, input().split()) dh, dw = map(lambda x: int(x)-1, input().split()) maze = [input() for _ in range(h)] INF = 10**12 path = [[INF] * w for _ in range(h)] #ここに各マスの移動コストを記録する walk = [(1,0), (0,1), (-1,0), (0,-1)] #ワープしない移動 wa...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 655], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["+"...
5
402
#include <bits/stdc++.h> using namespace std; #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) typedef long long int ll; typedef long double ld; typedef pair<int, int> P; template <typename T> struct V : vector<T> { using vector<T>::vector; }; V()->V<int>; V(size_t)->V<int>; templat...
#include <bits/stdc++.h> using namespace std; #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) typedef long long int ll; typedef long double ld; typedef pair<int, int> P; template <typename T> struct V : vector<T> { using vector<T>::vector; }; V()->V<int>; V(size_t)->V<int>; templat...
[["-", 8, 9, 0, 37, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 37, 0, 16, 31, 16, 12, 22]]
1
916
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define REP(a, b) for (int a = 0; a < (b); ++a) #define REP1(i, n) for (int i = 1; i <= (n); ++i) #define debug(x) cerr << #x << ": " << x << '\n' #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define YES() pri...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define REP(a, b) for (int a = 0; a < (b); ++a) #define REP1(i, n) for (int i = 1; i <= (n); ++i) #define debug(x) cerr << #x << ": " << x << '\n' #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define YES() pri...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
1,220
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using Pair = pair<int64_t, int64_t>; constexpr int64_t kInf = INT64_MAX / 2L; int main() { cin.tie(0); ios::sync_with_stdio(false); int64_t H, W; cin >> H >> W; int64_t start_r, start_c; cin >> start_r >> start...
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using Pair = pair<int64_t, int64_t>; constexpr int64_t kInf = INT64_MAX / 2L; int main() { cin.tie(0); ios::sync_with_stdio(false); int64_t H, W; cin >> H >> W; int64_t start_r, start_c; cin >> start_r >> start...
[["+", 3, 4, 0, 2, 3, 4, 0, 91, 17, 33]]
1
577
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using Pair = pair<int64_t, int64_t>; constexpr int64_t kInf = INT64_MAX / 2L; // std::cout << std::setprecision(20) << 1.1 << endl; int main() { cin.tie(0); ios::sync_with_stdio(false); int64_t H, W; cin >> H >> W...
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using Pair = pair<int64_t, int64_t>; constexpr int64_t kInf = INT64_MAX / 2L; // std::cout << std::setprecision(20) << 1.1 << endl; int main() { cin.tie(0); ios::sync_with_stdio(false); int64_t H, W; cin >> H >> W...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
567
#include <bits/stdc++.h> using namespace std; #define int ll #define ll long long #define I32_MAX 2147483647 #define I64_MAX 9223372036854775807LL #define I64_MAX2 1223372036854775807LL #define INF I64_MAX2 // #define MOD 1000000007 #define MOD 998244353 #define MEM_SIZE 101010 #define DEBUG_OUT true #define ALL(x) (...
#include <bits/stdc++.h> using namespace std; #define int ll #define ll long long #define I32_MAX 2147483647 #define I64_MAX 9223372036854775807LL #define I64_MAX2 1223372036854775807LL #define INF I64_MAX2 // #define MOD 1000000007 #define MOD 998244353 #define MEM_SIZE 101010 #define DEBUG_OUT true #define ALL(x) (...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22]]
1
843
#include <bits/stdc++.h> using namespace std; #define ll long long #define pld pair<long double, int> #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define ff first #define ss second #define SZ(x) ((int)(x).size()) #define ld long double mt19937 rng(chrono::steady_clock::now().time_since_epoc...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pld pair<long double, int> #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define ff first #define ss second #define SZ(x) ((int)(x).size()) #define ld long double mt19937 rng(chrono::steady_clock::now().time_since_epoc...
[["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 47]]
1
645
#include <bits/stdc++.h> using namespace std; #define ll long long int #define f first #define s second ll a, b, c, d, h, w; ll xDir[4] = {0, 0, -1, 1}; ll yDir[4] = {1, -1, 0, 0}; bool mat[1005][1005]; bool visited[1005][1005]; string s; bool isValid(ll x, ll y) { return x >= 0 && x < h && y >= 0 && y < w; } void solv...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define f first #define s second ll a, b, c, d, h, w; ll xDir[4] = {0, 0, -1, 1}; ll yDir[4] = {1, -1, 0, 0}; bool mat[1005][1005]; bool visited[1005][1005]; string s; bool isValid(ll x, ll y) { return x >= 0 && x < h && y >= 0 && y < w; } void solv...
[["-", 0, 57, 64, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 119, 120]]
1
560
#pragma target("avx") #pragma optimize("O3") #include <bits/stdc++.h> using ll = int_fast64_t; using P = std::pair<ll, ll>; using PP = std::pair<P, ll>; using V = std::vector<ll>; #define REP(i, b, e) for (ll i = b; i < e; i++) #define fi first #define se second int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -...
#pragma target("avx") #pragma optimize("O3") #include <bits/stdc++.h> using ll = int_fast64_t; using P = std::pair<ll, ll>; using PP = std::pair<P, ll>; using V = std::vector<ll>; #define REP(i, b, e) for (ll i = b; i < e; i++) #define fi first #define se second int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -...
[["-", 51, 16, 31, 16, 31, 16, 12, 16, 17, 18], ["+", 51, 16, 31, 16, 31, 16, 12, 16, 17, 19]]
1
553
// Think simple yet elegant. #include <bits/stdc++.h> using namespace std; #define fast \ ios::sync_with_stdio(0); \ cin.tie(0); \ ...
// Think simple yet elegant. #include <bits/stdc++.h> using namespace std; #define fast \ ios::sync_with_stdio(0); \ cin.tie(0); \ ...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22]]
1
651
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ff first #define ss second typedef long long ll; ll power(ll a, ll b) { // a^b ll res = 1; a = a % MOD; while (b > 0) { if (b & 1) { res = (res * a) % MOD; b--; } a = (a * a) % MOD; b >>= 1; } return res; ...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ff first #define ss second typedef long long ll; ll power(ll a, ll b) { // a^b ll res = 1; a = a % MOD; while (b > 0) { if (b & 1) { res = (res * a) % MOD; b--; } a = (a * a) % MOD; b >>= 1; } return res; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
1,024
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; using P = pair<int, pair<int, int>>; int dx1[] = {-1, 0, 0, 1}; int dy1[] = {0, 1, -1, 0}; int main() { int h, w; cin >> h >> w; int ch, cw, dh, dw; cin >> ch >> cw; cin >> dh >> dw; vector<st...
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; using P = pair<int, pair<int, int>>; int dx1[] = {-1, 0, 0, 1}; int dy1[] = {0, 1, -1, 0}; int main() { int h, w; cin >> h >> w; int ch, cw, dh, dw; cin >> ch >> cw; cin >> dh >> dw; vector<st...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22]]
1
548
//#include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define io ios::sync_with_stdio(false) using namespace std; typedef long long ll...
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define io ios::sync_with_stdio(false) using namespace std; typedef long long ll; const int inf = 0x3f3f3f3...
[["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120]]
1
608
#include <bits/stdc++.h> using namespace std; struct Ps { int r, c; Ps() : r(0), c(0) {} Ps(int r, int c) : r(r), c(c) {} Ps operator+(const Ps &p) const { return Ps(r + p.r, c + p.c); } friend istream &operator>>(istream &is, Ps &p) { is >> p.r >> p.c; return is; } }; int main() { int h, w; c...
#include <bits/stdc++.h> using namespace std; struct Ps { int r, c; Ps() : r(0), c(0) {} Ps(int r, int c) : r(r), c(c) {} Ps operator+(const Ps &p) const { return Ps(r + p.r, c + p.c); } friend istream &operator>>(istream &is, Ps &p) { is >> p.r >> p.c; return is; } }; int main() { int h, w; c...
[["-", 15, 339, 51, 16, 31, 16, 12, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 118, 28, 22], ["-", 15, 339, 51, 16, 12, 16, 12, 118, 28, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 118, 28, 22]]
1
628
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1001001001; int main() { int h, w; cin >> h >> w; int ch, dh, cw, dw; cin >> ch >> cw >> dh >> dw; ch--; cw--; dh--; dw--; vector<string> s(h); for (int i = 0; i < h; ++i) cin >> s[i]; vector<vector<int>> dis...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1001001001; int main() { int h, w; cin >> h >> w; int ch, dh, cw, dw; cin >> ch >> cw >> dh >> dw; ch--; cw--; dh--; dw--; vector<string> s(h); for (int i = 0; i < h; ++i) cin >> s[i]; vector<vector<int>> dis...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0,...
1
457
#include <algorithm> #include <cstring> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; constexpr int inf = 100000000; struct Point { Point(){}; Point(int h_, int w_) : h(h_), w...
#include <algorithm> #include <cstring> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; constexpr int inf = 100000000; struct Point { Point(){}; Point(int h_, int w_) : h(h_), ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
666
#include <bits/stdc++.h> #include <random> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define fr first #define sc second #define pll pair<ll, ll> #define all(v) v.begin(), v.end() int H, W; int sy, sx, gy, gx; string arr[1000]; int dist[1000][1000]; int dy[] = {0, 0, -...
#include <bits/stdc++.h> #include <random> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define fr first #define sc second #define pll pair<ll, ll> #define all(v) v.begin(), v.end() int H, W; int sy, sx, gy, gx; string arr[1000]; int dist[1000][1000]; int dy[] = {0, 0, -...
[["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
596
//--------------------------------------------------------------- #include <bits/stdc++.h> using namespace std; #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <numeric> #include <sstream> #include <vector> //...
//--------------------------------------------------------------- #include <bits/stdc++.h> using namespace std; #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <numeric> #include <sstream> #include <vector> //...
[["-", 0, 11, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
1,104
#include <deque> #include <iostream> #include <limits> constexpr int N = 1000; constexpr int M = 1000; char map[N + 2][M + 2]; int dist[N + 2][M + 2]; struct point_t { int x, y; }; /* .#. 1 3 1 1 3 1 .#. */ int main() { int H, W; std::cin >> H >> W; point_t maze, target; std::cin >> maze.x >> maze.y; st...
#include <deque> #include <iostream> #include <limits> constexpr int N = 1000; constexpr int M = 1000; char map[N + 2][M + 2]; int dist[N + 2][M + 2]; struct point_t { int x, y; }; int main() { int H, W; std::cin >> H >> W; point_t maze, target; std::cin >> maze.y >> maze.x; std::cin >> target.y >> target...
[["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 16, 12, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 16, 12, 118, 119, 120]]
1
527
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n, m; bool safe(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; } int main() { //...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n, m; bool safe(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; } int main() { //...
[["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
681
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <se...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <se...
[["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120]]
1
774
#include <bits/stdc++.h> #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define FSP(x) fixed << setprecision(x) using namespace std; using ll = long long; constexpr ll INF = LLONG_MAX; constexpr long double PI = acosl(-1); void Yes() { cout << "Yes\n"; } void No() { cout << "No\n"; } voi...
#include <bits/stdc++.h> #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define FSP(x) fixed << setprecision(x) using namespace std; using ll = long long; constexpr ll INF = LLONG_MAX; constexpr long double PI = acosl(-1); void Yes() { cout << "Yes\n"; } void No() { cout << "No\n"; } voi...
[["-", 8, 9, 0, 37, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 37, 0, 16, 31, 16, 12, 22]]
1
831
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) #define fi first #define se second long long mo = 1e9 + 7; typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; typedef p...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) #define fi first #define se second long long mo = 1e9 + 7; typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; typedef p...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
944
#include <sys/time.h> #include <algorithm> #include <cctype> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; using P = pair<int, i...
#include <sys/time.h> #include <algorithm> #include <cctype> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; using P = pair<int, i...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22]]
1
821
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) typedef tuple<int, int, int> P; vector<pair<int, int>> DXDY{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; const int INF = 10000000; int main() { int sx, sy, tx, ty; int h, w; ci...
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) typedef tuple<int, int, int> P; vector<pair<int, int>> DXDY{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; const int INF = 10000000; int main() { int sx, sy, tx, ty; int h, w; ci...
[["-", 0, 338, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 338, 8, 9, 0, 43, 49, 50, 49, 22]]
1
623
#include <bits/stdc++.h> #define ll long long int #define vec vector<ll> #define mat vector<vec> using namespace std; const ll mod = 1000000007; const ll inf = LONG_LONG_MAX; ll dx[4] = {1, 0, -1, 0}; ll dy[4] = {0, -1, 0, 1}; ll dx8[8] = {1, 0, -1, 1, -1, 1, 0, -1}; ll dy8[8] = {1, 1, 1, 0, 0, -1, -1, -1}; int main...
#include <bits/stdc++.h> #define ll long long int #define vec vector<ll> #define mat vector<vec> using namespace std; const ll mod = 1000000007; const ll inf = LONG_LONG_MAX; ll dx[4] = {1, 0, -1, 0}; ll dy[4] = {0, -1, 0, 1}; ll dx8[8] = {1, 0, -1, 1, -1, 1, 0, -1}; ll dy8[8] = {1, 1, 1, 0, 0, -1, -1, -1}; int main...
[["-", 31, 16, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 12, 22]]
1
872
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> using pv = vector<pair<T, U>>; template <typename T> using matrix = vector<vector<T>>; template <typename T> using pque = priority_queue<T>; template <typename T> using lpque = priority_queue<T, vector<T>, greater<T>>; using ll = long lon...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> using pv = vector<pair<T, U>>; template <typename T> using matrix = vector<vector<T>>; template <typename T> using pque = priority_queue<T>; template <typename T> using lpque = priority_queue<T, vector<T>, greater<T>>; using ll = long lon...
[["-", 0, 1, 0, 34, 12, 2, 63, 118, 28, 22], ["+", 0, 1, 0, 34, 12, 2, 63, 118, 28, 22]]
1
1,688
/* ____ ____ _ | _ \ _ __| _ \ ___ _ __ __| |_ __ ___ | | | | '__| | | |/ _ \ '_ \ / _` | '__/ _ \ | |_| | |_ | |_| | __/ | | | (_| | | | (_) | |____/|_(_)|____/ \___|_| |_|\__,_|_| \___/ */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_...
/* ____ ____ _ | _ \ _ __| _ \ ___ _ __ __| |_ __ ___ | | | | '__| | | |/ _ \ '_ \ / _` | '__/ _ \ | |_| | |_ | |_| | __/ | | | (_| | | | (_) | |____/|_(_)|____/ \___|_| |_|\__,_|_| \___/ */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 2, 63, 22], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 25]]
1
1,025
H,W,N=[int(s) for s in input().split()] hls=[0 for _ in range(H+1)] wls=[0 for _ in range(W+1)] bombs=[set() for _ in range(H+1)] for _ in range(N): h,w=[int(s) for s in input().split()] hls[h]+=1 wls[w]+=1 bombs[h].add(w) hmax=max(hls) wmax=max(wls) hmaxls=[i for i in range(H+1) if hls[i]==hmax] wmaxls=[i for ...
import itertools H,W,N=[int(s) for s in input().split()] hls=[0 for _ in range(H+1)] wls=[0 for _ in range(W+1)] bombs=[set() for _ in range(H+1)] for _ in range(N): h,w=[int(s) for s in input().split()] hls[h]+=1 wls[w]+=1 bombs[h].add(w) hmax=max(hls) wmax=max(wls) hmaxls=[i for i in range(H+1) if hls[i]==hma...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22]]
5
211
h,w,m = map(int,input().split()) x = {} y = {} dic = {} for _ in range(m): a,b = map(int,input().split()) dic[(a,b)] = 1 x[a] = x.get(a,0) + 1 y[b] = y.get(b,0) + 1 p = max(x.values()) q = max(y.values()) cnt = 1 a = [i for i in x if i == p] b = [j for j in y if j == q] for i in a: for j in b: ...
h,w,m = map(int,input().split()) x = {} y = {} dic = {} for _ in range(m): a,b = map(int,input().split()) dic[(a,b)] = 1 x[a] = x.get(a,0) + 1 y[b] = y.get(b,0) + 1 p = max(x.values()) q = max(y.values()) cnt = 1 a = [i for i in x if x[i] == p] b = [j for j in y if y[j] == q] for i in a: for j in b:...
[["+", 12, 658, 0, 678, 0, 666, 0, 206, 51, 22], ["+", 12, 658, 0, 678, 0, 666, 0, 206, 0, 70], ["+", 12, 658, 0, 678, 0, 666, 0, 206, 0, 73]]
5
188
#include <bits/stdc++.h> using namespace std; #define pai acos(-1) #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pll pair<ll, ll> #define sz(a) (ll) a.size() #define endl "\n" #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a)*((b)/gcd(a,b)) #define ...
#include <bits/stdc++.h> using namespace std; #define pai acos(-1) #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pll pair<ll, ll> #define sz(a) (ll) a.size() #define endl "\n" #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a)*((b)/gcd(a,b)) #define ...
[["-", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120]]
1
414
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define m...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define m...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
497
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> typedef char SINT8; typedef short SINT16; typedef int SINT32; typedef long long SINT64; typedef double DOUBLE; #define MAX(a, b) ((a) > (b) ? ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> typedef char SINT8; typedef short SINT16; typedef int SINT32; typedef long long SINT64; typedef double DOUBLE; #define MAX(a, b) ((a) > (b) ? ...
[["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
715
// #Sazaの1日1AC #include <bits/stdc++.h> using namespace std; const long long mod = 1000000000 + 7; const long long INF = 9e18; const double PI = 3.14159265358979323846; //マクロ //型エイリアス using ll = long long; using P = pair<long long, long long>; using vl = vector<long long>; using vvl = vector<vector<long long>>; using ...
// #Sazaの1日1AC #include <bits/stdc++.h> using namespace std; const long long mod = 1000000000 + 7; const long long INF = 9e18; const double PI = 3.14159265358979323846; //マクロ //型エイリアス using ll = long long; using P = pair<long long, long long>; using vl = vector<long long>; using vvl = vector<vector<long long>>; using ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
1,154
h,w,m=map(int,input().split()) h=[] w=[] for i in range(m): h_,w_=map(int,input().split()) h.append(h_) w.append(w_) from collections import Counter dic_h=Counter(h) dic_w=Counter(w) max_h=max(dic_h.values()) max_w=max(dic_w.values()) h_set=set() w_set=set() for i in dic_h: if dic_h[i]==max_h: h_set.add(i)...
h,w,m=map(int,input().split()) h=[] w=[] for i in range(m): h_,w_=map(int,input().split()) h.append(h_) w.append(w_) from collections import Counter dic_h=Counter(h) dic_w=Counter(w) max_h=max(dic_h.values()) max_w=max(dic_w.values()) h_set=set() w_set=set() for i in dic_h: if dic_h[i]==max_h: h_set.add(i)...
[["-", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22]]
5
204
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
446
/*input 2 3 3 2 2 1 1 1 3 */ #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; // antbook p155 const int INF = 1001001001; struct SegmentTree { int n; // size/2 vector<int> dat; // segment tree // n: num of elements SegmentTree(int n_...
/*input 2 3 3 2 2 1 1 1 3 */ #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; // antbook p155 const int INF = 1001001001; struct SegmentTree { int n; // size/2 vector<int> dat; // a segment tree // n: num of elements SegmentTree(int ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22]]
1
485
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define int long long constexpr long long INF = numeric_limits<long long>::max() / 2; constexpr int MOD = 1000000007; using Graph = vector<vector<int>>; signed main() { cin.tie(nullptr...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define int long long constexpr long long INF = numeric_limits<long long>::max() / 2; constexpr int MOD = 1000000007; using Graph = vector<vector<int>>; signed main() { cin.tie(nullptr...
[["-", 51, 16, 12, 69, 341, 342, 0, 69, 28, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70]]
1
357
h, w, m = list(map(int, input().split())) ms = [] hs = [0 for i in range(h)] ws = [0 for i in range(w)] for i in range(m): hi, wi = list(map(int, input().split())) ms.append((hi - 1, wi - 1)) hs[hi - 1] += 1 ws[wi - 1] += 1 maxh = max(hs) maxw = max(ws) cnt_h = sum([hs[i] == maxh for i in range(h)]) c...
h, w, m = list(map(int, input().split())) ms = [] hs = [0 for i in range(h)] ws = [0 for i in range(w)] for i in range(m): hi, wi = list(map(int, input().split())) ms.append((hi - 1, wi - 1)) hs[hi - 1] += 1 ws[wi - 1] += 1 maxh = max(hs) maxw = max(ws) cnt_h = sum([hs[i] == maxh for i in range(h)]) c...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
212
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; ++i) #define all(c) begin(c), end(c) /* */ map<pair<ll, ll>, ll> MP; int main() { cin.tie(0); ios::sync_with_stdio(0); ll H, W, M; cin >> H >> W >> M; vector<ll> Y(M, 0), X(M, 0), YM(H, 0), XM(W, 0); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; ++i) #define all(c) begin(c), end(c) /* */ map<pair<ll, ll>, ll> MP; int main() { cin.tie(0); ios::sync_with_stdio(0); ll H, W, M; cin >> H >> W >> M; vector<ll> Y(M, 0), X(M, 0), YM(H, 0), XM(W, 0); ...
[["+", 31, 69, 341, 342, 0, 83, 0, 16, 17, 72], ["+", 31, 69, 341, 342, 0, 83, 0, 16, 12, 13]]
1
366
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] tem = sc.nextLine().split(" "); int H = Integer.parseInt(tem[0]); int W = Integer.parseInt(tem[1]); int M = Integer.parseInt(tem[2]); int[] Harray = new int[H]; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] tem = sc.nextLine().split(" "); int H = Integer.parseInt(tem[0]); int W = Integer.parseInt(tem[1]); int M = Integer.parseInt(tem[2]); int[] Harray = new int[H]; ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22]]
3
538
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define fr(i, a, b) for (int i = a; i <= b; ++i) #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) ...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define fr(i, a, b) for (int i = a; i <= b; ++i) #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) ...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
664
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
641
#include <bits/stdc++.h> using namespace std; int p1, p2, a[300005], b[300005]; set<pair<int, int>> st; vector<int> v1, v2; int main() { int h, w, m; cin >> h >> w >> m; while (m--) { int x, y; cin >> x >> y; st.insert(make_pair(x, y)); a[x]++; b[y]++; if (a[x] > p1) v1.clear(), ...
#include <bits/stdc++.h> using namespace std; int p1, p2, a[300005], b[300005]; set<pair<int, int>> st; vector<int> v1, v2; int main() { int h, w, m; cin >> h >> w >> m; while (m--) { int x, y; cin >> x >> y; st.insert(make_pair(x, y)); a[x]++; b[y]++; if (a[x] > p1) v1.clear(), ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
267
#include <bits/stdc++.h> #include <stack> using namespace std; int main() { int h, w, m; cin >> h >> w >> m; // stack<pair<int,int>> hs; // stack<pair<int,int>> ws; vector<int> hcnt(h, 0); vector<int> wcnt(w, 0); int hm = 0; int wm = 0; // vector<pair<int,int>> bomb; set<pair<int, int>> bomb; int...
#include <bits/stdc++.h> #include <stack> using namespace std; int main() { int h, w, m; cin >> h >> w >> m; vector<int> hcnt(h, 0); vector<int> wcnt(w, 0); int hm = 0; int wm = 0; set<pair<int, int>> bomb; int cnt = -1; for (int i = 0; i < m; i++) { int y; int x; cin >> y >> x; y--; ...
[["+", 3, 4, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
340
#include <iostream> #include <set> #include <vector> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; set<pair<int, int>> pos; int xx[n + 1]; int yy[m + 1]; vector<int> x; vector<int> y; int maxx = 0; int maxy = 0; for (int i = 1; i <= n; ++i) xx[i] = 0; for (int i = 1; i <= ...
#include <iostream> #include <set> #include <vector> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; set<pair<int, int>> pos; int xx[n + 1]; int yy[m + 1]; vector<int> x; vector<int> y; int maxx = 0; int maxy = 0; for (int i = 1; i <= n; ++i) xx[i] = 0; for (int i = 1; i <= ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
353
#include <bits/stdc++.h> using namespace std; int h, w, m, a[300001], b[300001], p1, p2; typedef pair<int, int> pi; set<pi> st; int main() { int i, j, x, y; cin >> h >> w >> m; vector<int> l, r; for (i = 1; i <= m; ++i) { cin >> x >> y; st.insert(make_pair(x, y)); a[x]++; b[y]++; if (a[x] > ...
#include <bits/stdc++.h> using namespace std; int h, w, m, a[300001], b[300001], p1, p2; typedef pair<int, int> pi; set<pi> st; int main() { int i, j, x, y; cin >> h >> w >> m; vector<int> l, r; for (i = 1; i <= m; ++i) { cin >> x >> y; st.insert(make_pair(x, y)); a[x]++; b[y]++; if (a[x] > ...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
281
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 5; int h, w, n; int rc[N], rw[N]; vector<int> totc, totw; set<pair<int, int>> rcw; int maxr, maxw; int main() { ios::sync_with_stdio(false); cin >> h >> w >> n; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 5; int h, w, n; int rc[N], rw[N]; vector<int> totc, totw; set<pair<int, int>> rcw; int maxr, maxw; int main() { ios::sync_with_stdio(false); cin >> h >> w >> n; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
304
#include <bits/stdc++.h> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define re(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) #define pb push_back #define mp make_pair #define fi first #define se second ll binpow(ll x, ...
#include <bits/stdc++.h> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define re(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) #define pb push_back #define mp make_pair #define fi first #define se second ll binpow(ll x, ...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13]]
1
943
#include <bits/stdc++.h> typedef long long ll; using namespace std; const ll inf = 1000000007; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + (ch ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; const ll inf = 1000000007; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + (ch ...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 11, 17, 32]]
1
730
/*** Template Begin ***/ #pragma region template #define USING_NAMESPACE #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #i...
/*** Template Begin ***/ #pragma region template #define USING_NAMESPACE #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #i...
[["+", 0, 37, 0, 16, 31, 16, 31, 16, 17, 98], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 37, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 51, 218, 8, 9, 0, 37, 0, 16, 17, 98]]
1
1,748
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin()...
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin()...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 48], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13]]
1
1,030
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < b; i++) #define af(i, a, b) for (ll i = a; i >= b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(a)...
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < b; i++) #define af(i, a, b) for (ll i = a; i >= b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(a)...
[["-", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
643
#define _CRT_SECURE_NO_DEPRECATE #pragma GCC optimize("O3") #pragma GCC target("sse4") #include "bits/stdc++.h" //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __gnu_pbds; #define int long long int #define SYNC ...
#define _CRT_SECURE_NO_DEPRECATE #pragma GCC optimize("O3") #pragma GCC target("sse4") #include "bits/stdc++.h" //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __gnu_pbds; #define int long long int #define SYNC ...
[["-", 0, 23, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 23, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 37, 0, 23, 0, 16, 12, 91, 17, 111], ["+", 0, 37, 0, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 23, 0, 16, 12, 23, 0, 16, 17, 60], ["+", 0, 23, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 37, 0, 23, 0, 16, 12, 23, 0, 25]]
1
1,074
#include <bits/stdc++.h> using namespace std; const int nax = 3e5 + 5; struct pair_hash { inline long long operator()(const std::pair<int, int> &v) const { return (long long)v.first * nax + v.second; } }; int main() { int h, w, m, x, y; unordered_set<pair<int, int>, pair_hash> set; cin >> h >> w >> m;...
#include <bits/stdc++.h> using namespace std; const int nax = 3e5 + 5; struct pair_hash { inline long long operator()(const std::pair<int, int> &v) const { return (long long)v.first * nax + v.second; } }; int main() { int h, w, m, x, y; unordered_set<pair<int, int>, pair_hash> set; cin >> h >> w >> m;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
380
h, w, m = map(int, input().split()) h_b_list = [0 for i in range(h)] w_b_list = [0 for i in range(w)] targets = set() for i in range(m): bh, bw = map(int, input().split()) targets.add(bh, bw) h_b_list[bh-1] += 1 w_b_list[bw-1] += 1 h_max = max(h_b_list) w_max = max(w_b_list) h_cans = [] w_cans = [] for i...
h, w, m = map(int, input().split()) h_b_list = [0 for i in range(h)] w_b_list = [0 for i in range(w)] targets = set() for i in range(m): bh, bw = map(int, input().split()) targets.add((bh, bw)) h_b_list[bh-1] += 1 w_b_list[bw-1] += 1 h_max = max(h_b_list) w_max = max(w_b_list) h_cans = [] w_cans = [] for...
[["+", 0, 1, 0, 652, 3, 4, 0, 660, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 660, 0, 25]]
5
202
#include <bits/stdc++.h> using namespace std; vector<int> a[300001]; struct line { int i, cnt; inline bool operator<(const line &x) const { return cnt < x.cnt; } } b[300001]; int h, w, m, x_[300001], y_[300001], ans, cntx[300001], cnty[300001], vis[300001]; int main() { scanf("%d%d%d", &h, &w, &m); for (int...
#include <bits/stdc++.h> using namespace std; vector<int> a[300001]; struct line { int i, cnt; inline bool operator<(const line &x) const { return cnt > x.cnt; } } b[300001]; int h, w, m, x_[300001], y_[300001], ans, cntx[300001], cnty[300001], vis[300001]; int main() { scanf("%d%d%d", &h, &w, &m); for (int...
[["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 47]]
1
394
#!/usr/bin/env python3 from pprint import pprint import sys sys.setrecursionlimit(10 ** 6) H, W, M = map(int, input().split()) num_bombs_each_row = [0] * H num_bombs_each_col = [0] * W bombs = set() for _ in range(M): h, w = map(int, input().split()) # 0-index h -= 1 w -= 1 bombs.add((h, w)) ...
#!/usr/bin/env python3 from pprint import pprint import sys sys.setrecursionlimit(10 ** 6) H, W, M = map(int, input().split()) num_bombs_each_row = [0] * H num_bombs_each_col = [0] * W bombs = set() for _ in range(M): h, w = map(int, input().split()) # 0-index h -= 1 w -= 1 bombs.add((h, w)) ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 699]]
5
216
#include <bits/stdc++.h> using namespace std; #define ll long long #define print(x) cout << x << endl #define prints(x) cout << x << " " #define printline cout << endl bool comp(const pair<ll, ll> a, const pair<ll, ll> b) { return a.second > b.second; } int main() { std::ios_base::sync_with_stdio(false); ll h,...
#include <bits/stdc++.h> using namespace std; #define ll long long #define print(x) cout << x << endl #define prints(x) cout << x << " " #define printline cout << endl bool comp(const pair<ll, ll> a, const pair<ll, ll> b) { return a.second > b.second; } int main() { std::ios_base::sync_with_stdio(false); ll h,...
[["+", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
490
#include <bits/stdc++.h> using namespace std; int n, m, k, x, y; vector<pair<int, int>> p; vector<int> col, row; int main() { cin >> n >> m >> k; row.assign(n + 1, 0); col.assign(m + 1, 0); int mxr = 0, mxc = 0; for (int i = 0; i < k; i++) { cin >> x >> y; p.push_back({x, y}); row[x]++; col...
#include <bits/stdc++.h> using namespace std; int n, m, k, x, y; vector<pair<int, int>> p; vector<int> col, row; int main() { cin >> n >> m >> k; row.assign(n + 1, 0); col.assign(m + 1, 0); int mxr = 0, mxc = 0; for (int i = 0; i < k; i++) { cin >> x >> y; p.push_back({x, y}); row[x]++; col...
[["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
283
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL << ((ll)n)) #define SUBS(s, f, t) ((s).substr((f), (t) - (f))) #define ALL...
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL << ((ll)n)) #define SUBS(s, f, t) ((s).substr((f), (t) - (f))) #define ALL...
[["+", 341, 342, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
371
// Author : Mohamed sameh #include <bits/stdc++.h> typedef long long ll; #define pb push_back #define f first #define s second #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define SZ(a) (int)a.size() #define Flush fflush(stdout); using namespace std; const int N = 3e5 + 9, Lg = 26; int R[N], C...
// Author : Mohamed sameh #include <bits/stdc++.h> typedef long long ll; #define pb push_back #define f first #define s second #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define SZ(a) (int)a.size() #define Flush fflush(stdout); using namespace std; const int N = 3e5 + 9, Lg = 26; int R[N], C...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
656
#include <bits/stdc++.h> #include <unistd.h> #define fi first #define se second #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(a) a.begin(), a.end() #define pb push_back #define dame ...
#include <bits/stdc++.h> #include <unistd.h> #define fi first #define se second #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(a) a.begin(), a.end() #define pb push_back #define dame ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
2,017
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // __uint128_t const ll MOD = 1e9 + 7; int main() { ll H, W, M; cin >> H >> W >> M; map<ll, ll> MH, MW; vector<pair<ll, ll>> V(H + 1); for (int i = 0; i < M; i+...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // __uint128_t const ll MOD = 1e9 + 7; int main() { ll H, W, M; cin >> H >> W >> M; map<ll, ll> MH, MW; vector<pair<ll, ll>> V(M); for (int i = 0; i < M; i++) {...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
335
#include <bits/stdc++.h> using namespace std; int main() { int h, w, m; cin >> h >> w >> m; int r[m + 1] = {0}, c[m + 1] = {0}; set<pair<int, int>> p; while (m--) { int a, b; cin >> a >> b; p.insert({a, b}); r[a]++; c[b]++; } int x = 1, y = 1; for (int i = 1; i <= h; i++) { if (r...
#include <bits/stdc++.h> using namespace std; int main() { int h, w, m; cin >> h >> w >> m; int r[h + 1] = {0}, c[w + 1] = {0}; set<pair<int, int>> p; while (m--) { int a, b; cin >> a >> b; p.insert({a, b}); r[a]++; c[b]++; } int x = 1, y = 1; for (int i = 1; i <= h; i++) { if (...
[["-", 0, 43, 49, 50, 49, 80, 81, 16, 31, 22], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 31, 22]]
1
328
// Problem : E - Bomber // Contest : AtCoder - AtCoder Beginner Contest 176 // URL : https://atcoder.jp/contests/abc176/tasks/abc176_e // Memory Limit : 1024 MB // Time Limit : 3000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define flush cin.ignore...
// Problem : E - Bomber // Contest : AtCoder - AtCoder Beginner Contest 176 // URL : https://atcoder.jp/contests/abc176/tasks/abc176_e // Memory Limit : 1024 MB // Time Limit : 3000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define flush cin.ignore...
[["-", 12, 66, 28, 2, 3, 4, 0, 16, 12, 22], ["+", 12, 66, 28, 2, 3, 4, 0, 16, 12, 22]]
1
2,267
io = DATA.eof? ? STDIN : DATA h,w,m=io.gets.split.map(&:to_i) rc=m.times.map{io.gets.split.map(&:to_i)} r,c=rc.transpose rtally= r.tally ctally= c.tally rmax= rtally.values.max cmax= ctally.values.max rct=rtally.count{|r,maxct|maxct==rmax} cct=ctally.count{|c,maxct|maxct==cmax} if rct*cct>rc.count{|r,c|rtally[r]==rmax ...
io = DATA.eof? ? STDIN : DATA h,w,m=io.gets.split.map(&:to_i) rc=m.times.map{io.gets.split.map(&:to_i)} r,c=rc.transpose rtally= r.tally ctally= c.tally rmax= rtally.values.max cmax= ctally.values.max rct=rtally.count{|r,maxct|maxct==rmax} cct=ctally.count{|c,maxct|maxct==cmax} if rct*cct>rc.count{|r,c|rtally[r]==rmax ...
[["+", 36, 36, 36, 36, 36, 36, 36, 36, 0, 493], ["+", 36, 36, 36, 36, 36, 36, 0, 493, 0, 662], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 0, 493, 0, 662, 31, 22, 12, 754], ["+", 0, 493, 0, 662, 31, 22, 12, 754, 15, 652], ["+", 0, 662, 31, 22, 12, 754, 15, 652, 64, 743], ["+", 31, 22, 12, 754, 15, 652,...
4
147
#include <bits/stdc++.h> using namespace std; int main() { long H, W, M; cin >> H >> W >> M; vector<long> K(M); vector<long> O(M); long h = H + 1; long w = W + 1; int m = max(h, w); vector<long> A(m, 0); vector<long> B(m, 0); vector<long> a(m, 0); vector<long> b(m, 0); vector<long> D(m, 0); v...
#include <bits/stdc++.h> using namespace std; int main() { long H, W, M; cin >> H >> W >> M; vector<long> K(M); vector<long> O(M); long h = H + 1; long w = W + 1; int m = max(h, w); vector<long> A(m, 0); vector<long> B(m, 0); vector<long> a(m, 0); vector<long> b(m, 0); vector<long> D(m, 0); v...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22]]
1
967
#include <algorithm> #include <iostream> #include <set> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; typedef pair<long int, long int> P; int main() { long int H, W, M; cin >> H >> W >> M; long int h[M], w[M]; set<P> s; vector<long int> x(H), y(W); for (long int i = 0...
#include <algorithm> #include <iostream> #include <set> #include <string> #include <vector> //#include <bits/stdc++.h> using namespace std; typedef pair<long int, long int> P; int main() { long int H, W, M; cin >> H >> W >> M; long int h[M], w[M]; set<P> s; vector<long int> x(H), y(W); for (long int i = 0...
[["-", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22]]
1
453
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define input freopen("input.txt", "r", stdin) #define output freopen("output.txt", "w", stdout) #define si(a) scanf("%d", &a) #define sii(a, b) scanf("%d%d", &a, &b) #define siii(a, b, c) scanf("%d%d%d", &a, &b, &c) #define pi(a) printf("%d", a)...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define input freopen("input.txt", "r", stdin) #define output freopen("output.txt", "w", stdout) #define si(a) scanf("%d", &a) #define sii(a, b) scanf("%d%d", &a, &b) #define siii(a, b, c) scanf("%d%d%d", &a, &b, &c) #define pi(a) printf("%d", a)...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
448
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int MAXN = 300005; int tree[4 * MAXN], kiri[MAXN], kanan[MAXN]; pii a[MAXN]; int query(int now, int L, int R, int x, int y) { if (L >= x && R <= y) return tree[now]; if (L > y || R < x) return 0; int mid = (L + R) / 2; retu...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int MAXN = 300005; int tree[4 * MAXN], kiri[MAXN], kanan[MAXN]; pii a[MAXN]; int query(int now, int L, int R, int x, int y) { if (L >= x && R <= y) return tree[now]; if (L > y || R < x) return 0; int mid = (L + R) / 2; retu...
[["-", 3, 4, 0, 118, 28, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 118, 28, 69, 341, 342, 0, 22], ["-", 0, 7, 8, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 7, 8, 1, 0, 2, 3, 4, 0, 13]]
1
580
#include <bits/stdc++.h> #define FASTIO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; using ll = long...
#include <bits/stdc++.h> #define FASTIO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; using ll = long...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
346