output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <iostream> #include <sstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <ctime> #include <cstring> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <bitset> #include <numeric> #include <utility> #include <iomanip>...
### Prompt Please formulate a Cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include<iostream> #include<string> #include<queue> #include<utility> using namespace std; typedef pair<string,int> P; int main(){ int N,T; int bt,bm,at,am; char gav; string bs,as; queue<P > ok; cin>>N>>T; cin>>bt>>gav>>bm>>bs; for(int i=0;i<N-1;i++){ cin>>at>>gav>>am>>as>>bt>>gav>>bm>>bs; if((bt-at)*...
### Prompt Develop a solution in cpp to the problem described below: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include <cstdio> #include <vector> #include <string> using namespace std; char s[99]; int main(){ vector<pair<string,int> >v; int n,t,t1,t2,x,y; scanf("%d%d",&n,&t); scanf("%d:%d %s",&x,&y,s); for(n--;n--;){ scanf("%d:%d %s",&x,&y,s);t1=x*60+y; scanf("%d:%d %s",&x,&y,s);t2=x*60+y; if(t2-t1>=t)v.push_back(ma...
### Prompt Generate a Cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr...
#include <iostream> #include <string> #include <vector> using namespace std; int str_to_min(string s){ int num=0; num+=(s[0]-'0')*600; num+=(s[1]-'0')*60; num+=(s[3]-'0')*10; num+=(s[4]-'0'); return num; } int main(){ int N,T; cin>>N>>T; int cnt=0; string s1,s2,s3,s4; cin>>s1>>s2; vector<string>name; ...
### Prompt Create a solution in CPP for the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <cstdio> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <bitset> #define rep(i, n) for(int i = 0; i < (n); i++) #define FOR(i, a, b) for(int i = (a); i < (b); i++) #defi...
### Prompt Please formulate a cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include <bits/stdc++.h> using namespace std; #define GET_MACRO(_1, _2, _3, NAME, ...) NAME #define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define _rep(i,n) _repl(i,0,n) #define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all...
### Prompt Create a solution in Cpp for the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ...
/* * 2515.cc: Seishun 18 Kippu 2013 */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<...
### Prompt Please formulate a cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include <bits/stdc++.h> using namespace std; int main() { int N, T; cin >> N >> T; int sh, sm, ah, am; char ss[55], as[55]; scanf("%d:%d %s %d:%d %s", &sh, &sm, ss, &ah, &am, as); int prevt = ah * 60 + am; char prevs[55]; strcpy(prevs, as); int cnt = 0; char vis[11][55]; int vt[11]; for(int i ...
### Prompt Please formulate a CPP solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include<iostream> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<vector> #include<cmath> #include<cstdio> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define it ::iterator #define all(in) in.begin(),in.end...
### Prompt Please provide a Cpp coded solution to the problem described below: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c...
#include<bits/stdc++.h> using namespace std; int main(int argc, char *argv[]){ int n, t; cin >> n >> t; string s[2][n]; int time[2][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { int a, b; scanf("%d:%d ", &a, &b); time[j][i] = 60*a + b; cin >> s[j][i]; } } ...
### Prompt Construct a CPP code solution to the problem outlined: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc...
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> using namespace std; int main(){ int n, t; int h1, m1, h2, m2; string SStation, EStation; vector< pair<string, int> > stay(20); int ans = 0; cin >> n >> t; scanf("%d:%d", &h1, &m1); cin >> SStation; for(int i=0; ...
### Prompt In cpp, your task is to solve the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local...
#include<iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) int _convert(string str) { return str[0] * 600 + str[1] * 60 + str[3] * 10 + str[4]; } int convert(string str) { return _convert(str) - _convert("00:00"); } int main() { int n, t; cin >> n >> t; string a[n], b[n], ...
### Prompt Create a solution in CPP for the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int (i)=0; (i)<(int)(n); (i)++) #define all(x) (x).begin(),(x).end() int main(){ int N,T; cin>>N>>T; vector<int> st(N),ar(N); vector<string> name(N+2); rep(i,N){ int h,m; scanf("%d:%d",&h,&m ); st[i] = h*60+m; string dam; ...
### Prompt Your task is to create a cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r...
#include <iostream> #include <cstdio> #include <vector> using namespace std; typedef pair<string,int> P; int main(){ int n,t,sh,sm,gh,gm,dt; string name; vector<P> v; cin >> n >> t; scanf("%d:%d" ,&sh ,&sm); cin >> name; scanf("%d:%d" ,&gh ,&gm); cin >> name; int tt ...
### Prompt Create a solution in CPP for the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ...
#include<iostream> #include<string> #include<vector> using namespace std; struct S{ int stay_time; string stay_name; }; int main(){ int N,T; int fhh,fmm,thh,tmm; char gav; string fname,tname; int stay; S tmp; vector<S> ans; cin>>N>>T; cin>>fhh>>gav>>fmm>>fname; for(int i=0;i<N-1;i++){ cin>>fhh>>gav>...
### Prompt Please provide a cpp coded solution to the problem described below: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c...
#include <queue> #include <iostream> #define REP(i,n) for(int i=0; i<(int)(n); i++) #include <cstdio> #include <set> using namespace std; const int calc(const string &s){ const int a = s[0] - '0'; const int b = s[1] - '0'; const int c = s[3] - '0'; const int d = s[4] - '0'; return (a * 10 + b) * 60 + (c * 1...
### Prompt Please create a solution in CPP to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include<iostream> #include<string> #include<vector> using namespace std; int a[10000], b[10000], cnt; char c; string S[10000]; vector<int>A; vector<string>B; int n, m; int main() { cin >> n >> m; for (int i = 0; i < n * 2; i++) { cin >> a[i] >> c >> b[i] >> S[i]; if (i >= 1 && i % 2 == 0) { if ((a[i] * 60 + b...
### Prompt In Cpp, your task is to solve the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local...
#include <string> #include <cstdio> #include <algorithm> #include <vector> #include <iostream> using namespace std; int main() { int N, T; cin >> N >> T; vector<string> s(N), a(N); vector<int> st(N), at(N); for(int i=0; i<N; i++) { char b1[128], b2[128]; int h1, h2, m1, m2; scanf(" %d:%d %s %d:%d...
### Prompt In CPP, your task is to solve the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local...
#include <iostream> #include <vector> using namespace std; int toInt(string s){ int h = (s[0] - '0') * 10 + (s[1] - '0'); int m = (s[3] - '0') * 10 + (s[4] - '0'); return h * 60 + m; } int main(){ int n, m; int st_time[12], ar_time[12]; string st_name[12], ar_name[12]; while(cin >> n >> m){ for(int...
### Prompt Your task is to create a CPP solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r...
#include <stdio.h> #include <stdlib.h> #include <string.h> int timetoint(char str[]){ int i, j, h, s; char tmp1[12], tmp2[12]; for(i = 0; str[i]!=':'; i++){ tmp1[i] = str[i]; } tmp1[i] = '\0'; h = atoi(tmp1) * 60; for(j = 0, i++; str[i]!='\0'; i++, j++){ tmp2[j] = str[i]; } tmp2[j] = '\0'; ...
### Prompt Your task is to create a cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r...
#include <iostream> #include <string> using namespace std; int main() { int n, t; cin >> n >> t; string eki[10]; int ekii[10]; int counter = 0; string pss, pas, nss, nas; int pst, pat, nsh, nsm, nah, nam; char c; for (int i = 0; i < n; i++) { cin >> nsh >> c >> nsm >> nss >> nah >> c >> nam >> nas; if (i...
### Prompt Please create a solution in cpp to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <sstream> using namespace std; #define DEBUG(x) cerr << #x << " = " << x << endl template<class T, class U> T lexical_cast(const U& from) { stringstream ss; ss << from; T to; ss >> to; return to; } int toMinu...
### Prompt Please formulate a cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include<iostream> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<vector> #include<cmath> #include<cstdio> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define it ::iterator #define all(in) in.begin(),in.end...
### Prompt Generate a Cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr...
#include<iostream> #include<vector> #include<utility> #include<map> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) using namespace std; struct data{ int start,end; string stname,edname; }; int func(string s){ int fr=(s[0]-'0')*10+(s[1]-'0'),ba=(s[3]-'0')*10+(s[4]-'0'); return fr*60+ba; } i...
### Prompt In Cpp, your task is to solve the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local...
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; int calcTime(int h1, int m1, int h2, int m2){ int t1, t2; t1 = h1*60 + m1; t2 = h2*60 + m2; return t2 -...
### Prompt Construct a Cpp code solution to the problem outlined: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc...
#include <iostream> #include <iomanip> #include <cstdio> #include <vector> #include <algorithm> #include <complex> #include <cstring> #include <cstdlib> #include <string> #include <cmath> #include <cassert> #include <queue> #include <set> #include <map> #include <valarray> #include <bitset> #include <stack> using names...
### Prompt Please provide a cpp coded solution to the problem described below: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c...
#include <iostream> using namespace std; string a[100],b[100],c[100],d[100]; int calc(string s){ return ((s[0]-'0')*10+(s[1]-'0'))*60+(s[3]-'0')*10+s[4]-'0'; } int main(){ int N,T; cin >> N >> T; int cnt = 0; for(int i = 0 ; i < N ; i++){ cin >> a[i] >> b[i] >> c[i] >> d[i]; if(i){ if( calc(a[i])-calc(c[...
### Prompt In CPP, your task is to solve the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local...
#include<iostream> #include<string> using namespace std; int main() { int n, t, cnt = 0; string a[10], b[10], c[10], d[10]; cin >> n >> t; cin >> a[0] >> b[0] >> c[0] >> d[0]; for( int i = 1; i < n; i++ ) { cin >> a[i] >> b[i] >> c[i] >> d[i]; int diffa = 600 * ( a[i][0] -...
### Prompt Please provide a Cpp coded solution to the problem described below: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c...
#include <bits/stdc++.h> using namespace std; int main() { int N, T; cin >> N >> T; vector<string> vs; vector<int> vi; int sh, sm, eh, em; char c; string st, sr; cin >> sh >> c >> sm >> st >> eh >> c >> em >> sr; for (int i = 1; i < N; i++) { int times = eh * 60 + em; ...
### Prompt Please formulate a cpp solution to the following problem: Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ...
#include <iostream> #include <cstdio> #include <string> #include <vector> using namespace std; typedef pair<string, int> P; void solve() { int N, H; cin >> N >> H; vector<P> input(N); for (int i = 0; i < N; ++i) { cin >> input[i].first >> input[i].second; } int mistake = 0; int count = 0; int word = 0; in...
### Prompt Create a solution in cpp for the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with respect to the ...
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int,int> pii; typedef long long ll; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define all(a) (a).begin(),(a).end() #define pb push_back #ifdef Debug #define dump(x) cerr << #x << " = " << (x) << endl #else #define dump(x) #endif b...
### Prompt Your challenge is to write a CPP solution to the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with...
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cctype> using namespace std; int main(){ ios_base::sync_with_stdio(false); int n, h; cin >> n >> h; vector<string> s(n); vector<int> t(n); for(int i = 0; i < n; ++i){ cin >> s[i] >> t[i]; } int success = 0, fail = 0; for(in...
### Prompt Generate a Cpp solution to the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with respect to the AI...
#include <bits/stdc++.h> using namespace std; #define rep2(i,a,b) for(int i=(a);i<(b);i++) #define rep(i,n) rep2(i,0,n) #define sz(x) ((int)(x).size()) const int INF = 1070000000; int N, H; string S[111]; int T[111]; bool same(char a, char b){ a = tolower(a); b = tolower(b); return a==b; } int main(){ scanf("%...
### Prompt In cpp, your task is to solve the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with respect to the...
/* * 2676.cc: Typing Game */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #...
### Prompt Create a solution in Cpp for the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with respect to the ...
#include <iostream> #include <iomanip> #include <sstream> #include <vector> #include <string> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <functional> #include <iterator> #include <limits> #include <nume...
### Prompt Please provide a cpp coded solution to the problem described below: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with...
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <ctime> #include <cassert> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; typedef pair<int,int> P; ty...
### Prompt Your challenge is to write a cpp solution to the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with...
#include<cstdio> #include<cstring> #include<ctype.h> using namespace std; int N, H; int T[1000]; char S[1000][210]; char c[20]; int result[20] = {0}; int main() { scanf("%d%d", &N, &H); for(int i = 0; i < N; i++) { scanf("%s%d", S[i], &T[i]); } for(int i = 0; i < N; i++) { int len = strlen(S[i]); ...
### Prompt Please provide a CPP coded solution to the problem described below: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with...
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> using namespace std; typedef long long ll; const int INF=2000000000; int main(){ int n,h,t[100],ansa=0,ansb=0; char s[100][16],in[2]; s...
### Prompt Please provide a Cpp coded solution to the problem described below: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with...
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) using namespace std; int N,H; string s[110]; int cap[110]; int main(){ cin >> N >> H; rep(i,N) cin >> s[i] >> cap[i]; double numType = 0; double numSucc = 0; rep(i,N){ int cur = 0, miss = 0; //char S[20]; ...
### Prompt Your challenge is to write a Cpp solution to the following problem: H: Typing Game / Typing Game story From here, it's time to train your typing skills. Can you type quickly and accurately? Let ’s enjoy Typing Game! problem As a typing game game system, create a program that operates interactively with...
#include<bits/stdc++.h> using namespace std; typedef long long int64; const int64 INF = 1LL << 55; int N, M, T; int x[200000], y[200000], z[200000]; vector< pair< int, int > > g[200000]; int64 v[200000]; struct UnionFind { vector< int64 > data, time, score; UnionFind(int sz) { data.assign(sz, -1LL); ...
### Prompt Create a solution in Cpp for the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also, th...
#include <iostream> #include <vector> #include <array> #include <list> #include <string> #include <stack> #include <queue> #include <deque> #include <unordered_map> #include <unordered_set> #include <tuple> #include <memory> #include <cmath> #include <algorithm> #include <functional> #include <iomanip> #include <numeri...
### Prompt Your task is to create a CPP solution to the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i...
#include <iostream> #include <iomanip> #include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <algorithm> #include <numeric> #include <random> #include <vector> #include <array> #include <bitset> #include <queue> #include <set> #include <unordered_set> #include <map> #include <unordered_map...
### Prompt Please create a solution in CPP to the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Al...
#include<bits/stdc++.h> using namespace std; struct edge{int from,to,t;}; #define MAX_N 100005 typedef long long ll; struct UF{ int group; int par[MAX_N]; int flg[MAX_N]; int size[MAX_N]; ll dat[MAX_N]; void init(int n){ group=n; for(int i=0;i<MAX_N;i++){ par[i]=i; flg[i]=0; ...
### Prompt Create a solution in Cpp for the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also, th...
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; #define NUM 100000 struct Edge{ Edge(int arg_from,int arg_to,int arg_time){ from = arg_from; to = arg_to; time = arg_time; } boo...
### Prompt Please provide a CPP coded solution to the problem described below: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $...
#include <bits/stdc++.h> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all(x) (x).begin(),(x).end() #define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x)) #define fi first #define se...
### Prompt Develop a solution in cpp to the problem described below: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Al...
#include<bits/stdc++.h> using namespace std; typedef long long LL; #define CIN_ONLY if(1) struct cww{cww(){ CIN_ONLY{ ios::sync_with_stdio(false);cin.tie(0); } }}star; #define fin "\n" #define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #defi...
### Prompt Your task is to create a CPP solution to the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i...
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define all(v) (v).begin(),(v).end() #define pb push_back typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; #define fi first #define se second template<typename A,typename B>inline v...
### Prompt In Cpp, your task is to solve the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also, t...
#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif #define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f...
### Prompt Please provide a cpp coded solution to the problem described below: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $...
#include "bits/stdc++.h" using namespace std; struct edge { int from; int to; int t; }; int N, M, T; void bfs(const vector<vector<edge>>&edges, vector<int>&can_go) { queue<pair<int, int>>que; que.emplace(0, 0); can_go[0] = true; while (!que.empty()) { auto atop(que.front()); que.pop(); const int nexttime...
### Prompt Create a solution in cpp for the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also, th...
#include <bits/stdc++.h> using namespace std; using VI = vector<int>; using VVI = vector<VI>; using PII = pair<int, int>; using LL = long long; using VL = vector<LL>; using VVL = vector<VL>; using PLL = pair<LL, LL>; using VS = vector<string>; #define ALL(a) begin((a)),end((a)) #define RALL(a) (a).rbegin(), (a).rend...
### Prompt In CPP, your task is to solve the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also, t...
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using...
### Prompt Construct a Cpp code solution to the problem outlined: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also,...
#include <iostream> #include <vector> #include <queue> using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define pb push_back typedef long long ll; typedef pair<int, int> i_i; const int INF = 1145141919; struct union_find { vector<int> v; union_find(int n) : v(n, -1) {} int find(int x) { return v...
### Prompt Please formulate a CPP solution to the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Al...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i...
### Prompt Your task is to create a cpp solution to the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i...
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; using PII = pair<ll, ll>; using PP = pair<ll, PII>; #define FOR(i,a,n) for(ll i=(ll)a; i<(ll)n; ++i) #define REP(i,n) FOR(i,0,n) const ll INF = 1LL << 60; template<typename T> void chmin(T &a, T b) { a = min(a, b); } vector<PII>...
### Prompt Develop a solution in cpp to the problem described below: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Al...
#include <bits/stdc++.h> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all(x) (x).begin(),(x).end() #define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x)) #define fi first #define se...
### Prompt Create a solution in CPP for the following problem: problem There is a simple concatenated undirected graph with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ dots, N $. The edges are numbered $ 1, 2, \ dots, M $, and the edge $ i $ connects the vertices $ a_i $ and $ b_i $. Also, th...
#include <bits/stdc++.h> using namespace std; using lint = long long; template<class T = int> using V = vector<T>; template<class T = int> using VV = V< V<T> >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int h, w; cin >> h >> w; V<string> s(h); for (auto&& e : s) cin >> e; int res = 0; for (...
### Prompt Construct a cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
// // Created by yamunaku on 2019/07/14. // #include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) #define repl(i, l, r) for(int i = (l); i < (r); i++) #define per(i, n) for(int i = ((n)-1); i >= 0; i--) #define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--) #define all(x) (x...
### Prompt Please provide a CPP coded solution to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include<algorithm> #include<climits> #include<cmath> #include<cstring> #include<deque> #include<iomanip> #include<iostream> #include<map> #include<queue> #include<set> #include<stack> #include<unordered_map> #include<unordered_set> #include<utility> #include<vector> using namespace std; using lint = long long; using...
### Prompt Please formulate a Cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include<iostream> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<iomanip> #include<limits> #include<deque> #include<map> #include<list> #include<set> #include <unordered_set> #include<vector> #include<cmath> #include<cstdio> #include<memory> #include<bitset> #include<stack> #include<...
### Prompt Develop a solution in CPP to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <iostream> #include <complex> #include <string> #include <algorithm> #include <numeric> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <bitset>...
### Prompt Generate a Cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a huge...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pi; typedef pair<pi, pi> pp; typedef pair<ll, ll> pl; const double EPS = 1e-9; const ll MOD = 1000000007; const int inf = 1 << 30; const ll linf = 1LL <...
### Prompt Please provide a CPP coded solution to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i)) using ll = long long; using P = pair<int, int>; using namespace std; string canpas[31]; int main() { int H, W; cin >> H >> W; rep(i, H) cin >> canpas[i]; vector<P> pos; rep(r, H) rep(c, W) { ...
### Prompt Your task is to create a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front ...
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> usi...
### Prompt Your task is to create a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front ...
#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int main(){ char s[40][40]; int h,w,cnt; cin >> h >> w; for(int i=0;i<h;i++){ scanf("%s",s[i]); } cnt = 0; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ for(int k=0;k<h;k++){...
### Prompt Generate a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a huge...
#include <iostream> #include <iomanip> #include <cstdio> #include <string> #include <cstring> #include <deque> #include <list> #include <queue> #include <stack> #include <vector> #include <utility> #include <algorithm> #include <map> #include <set> #include <complex> #include <cmath> #include <limits> #include <cfloat>...
### Prompt Your challenge is to write a Cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include<iostream> #include<algorithm> using namespace std; char G[1000][1000]; int H, W; int solve(){ int mi = 1000000000; int ma = 0; for ( int i = 0; i < H; i++ ){ for ( int j = 0; j < W; j++ ){ if ( G[i][j] == '.' ) continue; mi = min(mi, i+j); ma = max(ma, i+j); } } return ma ...
### Prompt Generate a Cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a huge...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; vector<string> ss(h); for (int i = 0; i < h; i++) cin >> ss[i]; vector<pair<int, int>> ps; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { ...
### Prompt Generate a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a huge...
#include<bits/stdc++.h> using namespace std; int main(){ int H,W; cin >> H >> W; vector<string> c(H); int max = 0; for(int i = 0;i < H;++i) cin >> c[i]; for(int i = 0;i < H;++i){ for(int j = 0;j < W;++j){ for(int k = 0;k < H;++k){ for(int l = 0;l < W;++l){ if(c[i][j] == 'B' && c[k...
### Prompt Your task is to create a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef long long int ...
### Prompt In Cpp, your task is to solve the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a h...
#include<bits/stdc++.h> using namespace std; int main(){ int h,w; cin>>h>>w; vector<string> c(h); for(int i=0;i<h;i++){ cin>>c[i]; } vector<pair<int,int>> pos; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(c[i][j]=='B') pos.push_back(make_pair(i,j)); } ...
### Prompt Your challenge is to write a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include "bits/stdc++.h" using namespace std; void solve(void) { int h, w; cin >> h >> w; vector<int> ps, qs; for (int i = 0; i < h; i++) { string g; cin >> g; for (int j = 0; j < w; j++) { if (g[j] == 'B') { ps.push_back(i+j); qs.push_back(i+w-j); } } } sort(ps.begin(), ps.end()); ...
### Prompt Your challenge is to write a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> #include<complex> using namespace std; #defi...
### Prompt Please formulate a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
//#pragma GCC optimize ("-O3","unroll-loops") #include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #include<cstdio> #include<functional> #include<bitset> #include<limits.h> #include<cas...
### Prompt Please create a solution in Cpp to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it...
### Prompt Please formulate a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
### Prompt Construct a Cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #define _GLIBCXX_DEBUG #include "dump.hpp" #else #define dump(...) #endif #define int long long #define ll long long #define DBG 1 #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--) #define loop(n) r...
### Prompt Construct a Cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <deque> #include <bitset> #include <algorithm> #include <complex> #include <array> using namespace std; #define REP(i,n) for(int i=0; i...
### Prompt Your task is to create a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; signed main(){ ios::sync_with_stdio(false); cin.tie(0); int h,w; cin>>h>>w; string s[h]; for(int i=0;i<h;i++){ cin>>s[i]; } vector<pair<int,int>> v; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ ...
### Prompt Construct a Cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
#include<iomanip> #include<limits> #include<thread> #include<utility> #include<iostream> #include<string> #include<algorithm> #include<set> #include<map> #include<vector> #include<stack> #include<queue> #include<cmath> #include<numeric> #include<cassert> #include<random> #include<chrono> #include<unordered_set> #includ...
### Prompt Please formulate a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; constexpr ld EPS = 1e-12; constexpr int INF = numeric_limits<int>::max() / 2; constexpr int MOD = 1e9 + 7; template <typename T> void printv(const vector<T> &v) { int sz = v.size(); for (int ...
### Prompt Please formulate a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1); #define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++) #define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_...
### Prompt Please provide a cpp coded solution to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 #define BIG 1000000010 #define EPS 1e-9 #define fst first #define scd second #define debug(x) cout<<x<<endl; #define repi(i,x,n) for(int i=x;i<n;i++) #define rep(i,n) repi(i,0,n) #define repn(i,n) for(int i=n;i>=0;i--) #define int long long #define en...
### Prompt Your task is to create a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front ...
#include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = uint32_t; using namespace std; template<class T> constexpr T INF = ::nu...
### Prompt Generate a Cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a huge...
/* -*- coding: utf-8 -*- * * 2952.cc: */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #inc...
### Prompt Please formulate a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define REP(i,n) for(int i=0;i<(int)(n);i++) #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a)...
### Prompt Construct a Cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
#include <iostream> #include <algorithm> #include <vector> #include <stdio.h> using namespace std; int main(){ int H,W,n=0; int ans=0; cin>>H>>W; char c[40][40]; int xa[30*30],ya[30*30]; for(int y=0;y<H;y++){ for(int x=0;x<W;x++){ cin>>c[y][x]; if(c[y][x] == 'B'){ xa[n]=x; ...
### Prompt Please provide a CPP coded solution to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#include <iostream> #include <stdlib.h> using namespace std; int main() { int H, W; char c[31][31]; int max = 0; cin >> H >> W; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { cin >> c[i][j]; } } for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if(c[i][j] ...
### Prompt In cpp, your task is to solve the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a h...
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define eb ...
### Prompt Develop a solution in CPP to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; #define SIZE 35 struct LOC{ LOC(int arg_row,int arg_col){ row = arg_row; col = arg_col; } int ...
### Prompt Please formulate a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, s, n) for (int i = (s); i < (n); i++) #define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define IN(a, x, b) (a <= x && x < b) cons...
### Prompt Your challenge is to write a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...
#pragma GCC optimize("Ofast") #pragma GCC target ("avx") #include <bits/stdc++.h> constexpr int INF = 2147483647; constexpr long long int INF_LL = 9223372036854775807; constexpr int MOD = 1000000007; using namespace std; typedef long long int ll; typedef unsigned long long int ull; int main() { int H, W; cin >> H >...
### Prompt Construct a Cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
#include<bits/stdc++.h> using namespace std; int main(){ int h,w,m=0,cnt=0,sx[900],sy[900]; string str[30]; cin>>h>>w; for(int i=0;i<h;++i) cin>>str[i]; for(int i=0;i<h;++i){ for(int j=0;j<w;++j){ if(str[i][j]=='B'){ sx[cnt]=j; sy[cnt]=i; ++cnt; } } } for(int i=0;i<cnt-1;++i){ for...
### Prompt Create a solution in CPP for the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a hu...
#include<bits/stdc++.h> using namespace std; #define lp(i,n) for(int i=0;i<(n);i++) #define int long long signed main() { int H,W; cin>>H>>W; vector<string> s(H); for(int i=0;i<H;i++){ cin>>s[i]; } int ans=0; for(int i=0;i<H*W;i++){ for(int j=0;j<H*W;j++){ int y1=i/W, x1=i%...
### Prompt Generate a cpp solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a huge...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1e9 + 7; const int inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; #include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(const char *s) { return to_string((...
### Prompt Develop a solution in CPP to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include<bits/stdc++.h> using namespace std; #define INF (1<<28) #define DEKAI 1000000007 #define lp(i,n) for(int i=0;i<n;i++) #define int long long signed main(){ int h,w;; cin>>h>>w; vector<int> a,b; lp(i,h){ lp(j,w){ char c; cin>>c; if(c=='B'){ a.push_back(i+j); b.push_back(j-i); } }...
### Prompt Create a solution in cpp for the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a hu...
#include <iostream> #include <vector> #include <algorithm> #include <utility> #include <cmath> using namespace std; vector<int> v[1010]; vector<pair<int,int>> u; int main(){ int i,j,h,w; cin >> h >> w; for(i=0;i<h;i++){ for(j=0;j<w;j++){ char c; cin >> c; if(c=='B'){ v[i].push_back(j); } } } for(i...
### Prompt Please create a solution in Cpp to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her...
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(ll (i) = (0);(i) < (n);++i) #define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << end...
### Prompt Construct a cpp code solution to the problem outlined: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a...
#pragma GCC optimize ("O3") #pragma GCC target ("tune=native") #pragma GCC target ("avx") #include <bits/stdc++.h> // 汎用マクロ #define ALL_OF(x) (x).begin(), (x).end() #define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++) #define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++) #define DS...
### Prompt Your task is to create a CPP solution to the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front ...
#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <climits> #include <vector> #include <map> #include <set> #include <list> #include <stack> #include <queue> #include <algorithm> #include <iostream> #include <string> #define REP(i,n) for(long long i=0;i<n;++i) #define REPR(i,n) for(long...
### Prompt In Cpp, your task is to solve the following problem: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, a h...
#include <iostream> #include <algorithm> #include <vector> #include <math.h> using namespace std; typedef long long ll; int main() { int h, w; cin >> h >> w; char s[1010][1010]; vector<pair<int, int> > b; for (int i = 0; i < h; i++) { cin >> s[i]; for (int j = 0; j < w; j++) { ...
### Prompt Please provide a cpp coded solution to the problem described below: A: Hokkaido University Easy Note Please note that the problem settings are the same as problem B, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in fr...