prompt
string
response
string
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> using namespace std; using Int = long long; using Double = long double; signed main(){ Int h,w; cin>>w>>h; vector<string> s(h); for(Int i=0;i<h;i++) cin>>s[i]; vector<vector<Int> > dg(h,vector<Int>(w,-1)),ds=dg; using T = pair<Int,int>; queue<T> qg,qs; for(Int i=0;i<h;i++){ ...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-10; const int H = 500; const int W = 500; const int dy[4] = {-1,0,1,0}; const int dx[4] = {0,-1,0,1}; struct P{ int x, y; P(int x=0, int y=0):x(x),y(y){} }; struct state{ int x, y, cnt; state(int x=0, int y=0, int cnt=0):x(x),y(y),cnt...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<iostream> #include<climits> #include<cstdio> #include<queue> using namespace std; #define REP(i,b,n) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; const int N = 500; const int dx[]={1,0,-1,0}; const int dy[]={0,1,0,-1}; const ll inf = 1LL<<60; char m[N][N+1]; ll dcost[N][N];//’¼ÚƒS...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; #define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define peri(i,a,b) for(int i=int(b);i-->int(a);) #define rep(i,n) repi(i,0,n) #define per(i,n) peri(i,0,n) #define all(c) begin(c),end(c) #define mp make_pair #define mt make...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; typedef long double ld; const int MAX = 501,IINF = INT_MAX; const ld LDINF = 1e100; int H,W,sx,sy,gx,gy; ld mincost[MAX][MAX][2]; // mincost[][...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; using dbl = long double; using Pi = pair<int, int>; const dbl eps = 1e-15; #define lt(a, b) ((a)-(b) < -eps) #define eq(a, b) (fabs((a)-(b)) < eps) int W, H; char mas[505][505]; Pi S, G; vector<Pi> Bs; const int dy[] = {-1, 0, 1, 0}; const int dx[] = {0, -1, 0, 1}; bo...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) #define MAX_V 1000 using namespace std; typedef long long ll; typedef pair<int,int> P; const long long int MOD = 1000000007; const long long int INF = 100000000000000; int h, w; P st, go; char b[500][500]; ll gist[500][500], wist[500][500]; queue<P> ...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} template<class T> inline T sqr(T x) {return x*x;} typedef vector<int> vi; typedef vector<vi> vvi; typed...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; typedef long double ld; const int MAX = 501,IINF = INT_MAX; const ld LDINF = 1e100; int H,W,sx,sy,gx,gy; ld mincost[MAX][MAX][2]; // mincost[][...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
from collections import deque import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): W, H = map(int, readline().split()) S = [readline().strip() for i in range(H)] R = [[0]*W for i in range(H)] P = [] cnt = 0 for i in range(H): Si = S[i] for j in range(W):...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<iostream> #include<climits> #include<cstdio> #include<queue> using namespace std; #define REP(i,b,n) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; const int N = 500; const int dx[]={1,0,-1,0}; const int dy[]={0,1,0,-1}; const ll inf = 1LL<<60; char m[N][N+1]; ll dcost[N][N];//直接ã...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> #define int long long using namespace std; template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); } template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); } const int INF = 1e+15; const double EPS = 1e-8; const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1}; int w,h,sx,sy,gx,g...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<stdio.h> #include<algorithm> #include<queue> using namespace std; char str[600][600]; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; long double ijk[600][600]; long double ijk2[600][600]; long double eps=1e-10L; pair<long double,pair<int,int> > v[1000000]; int t[600][600]; int main(){ int a,b; scanf("%d%d",&b,&a)...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> using namespace std; const int M = 1000000007; const long long LM = (long long)1e17; int d[5] = { 0, 1, 0, -1, 0 }; int main() { int w, h, si, sj, gi, gj; cin >> w >> h; vector<string> s(h); queue<pair<int, int>> q; vector<vector<int>> dsp(h, vector<int>(w, M)); vector<...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <iostream> #include <sstream> #include <string> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cassert> using namespace std; #define FOR(i,k,n) for(int i=(k); i<(int)(n);...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin....
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<cstdio> #include<queue> #include<vector> #include<algorithm> using namespace std; const int dx[]={1,0,-1,0},dy[]={0,1,0,-1}; char field[550][550]; int H,W; int dis[550][550],dis2[550][550]; vector<int> si,sj; void bfs(int res[550][550]){ for(int i=0;i<H;i++) for(int j=0;j<W;j++) res[i][j]=-1; queue<int>...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) typedef long long LL; struct position{ LL x; LL y; LL count; }; int main(){ LL w,h; LL houkou[5]={0,1,0,-1,0}; cin >> w >> h; vector<vector<LL>> field(h,vector<LL>(w)); list<struct pos...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#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...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#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 500 struct LOC{ void set(int arg_row,int arg_col){ row = arg_row; col = arg_col; } int row,col; }; struct Info{ LOC...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#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...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; #define FOR(i,k,n) for(int i = (k); i < (n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(a) a.begin(), a.end() #define MS(m,v) memset(m,v,sizeof(m)) #define D10 fixed<<setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii; typedef l...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline ...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
from collections import deque w, h = map(int, input().split()) mp = [input() for _ in range(h)] springs = [] tile_cnt = 0 for y in range(h): for x in range(w): if mp[y][x] == "*": springs.append((x, y)) if mp[y][x] == "g": gx, gy = x, y if mp[y][x] == "s": sx, sy = x, y tile_cnt ...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <cmath> #include <algorithm> #include <functional> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define rep1(i,n) for(int i=1;i<=(n);++i) #define all(c) (c).begin(),(c).end() #define pb push_back #define fs first #define s...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; typedef long double ld; const int MAX = 501,IINF = INT_MAX; const ld LDINF = 1e100; int H,W,sx,sy,gx,gy; ld mincost[MAX][MAX][2]; // mincost[][...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Main { public static final int[] vs = {1, 0, -1, 0}; public static final double EPS = 1e-10; ...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <cmath> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #define double long double #define INF 1.0e12 using namespace std; typedef long long int ll; typedef pair<int, int> P; typede...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double>...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int W, H; int sx, sy, gx, gy; vector<string> vs; vector<vector<long double> > gdist; vector<vector<long double> > sdist; void make() { gdist[gx][gy] = 0; queue<P> que; que.push(P(gx...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <iostream> #include <stdio.h> #include <vector> #include <utility> #include <queue> #define inf 1e30 using namespace std; typedef pair<int, int> pos; typedef pair<long double, pos> P; int W, H; char map[505][505]; int sx, sy, gx, gy; long double dist[505][505]; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1,...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <cstdio> #include <queue> #include <vector> #include <algorithm> using namespace std; typedef long double real; const real inf = 1e20; struct point { int x, y; }; int dx[] = {-1, 0, 0, 1}; int dy[] = {0, -1, 1, 0}; vector<real> dist; // ret1: true if arg e < calculated e // ret2: expected s-g value if e ...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<int, int>; const double eps = 1e-8; const ll MOD = 1000000007; const int INF = INT_MAX / 2; const ll LINF = LLONG_MAX / 2; template <typena...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; typedef long double ld; const int MAX = 501,IINF = INT_MAX; const ld LDINF = 1e100; int H,W,sx,sy,gx,gy; ld mincost[MAX][MAX][2]; // mincost[][...
Problem: One morning when you woke up, it was in a springy labyrinth. I don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like this for a long time, a gust of wind will surely blow you away. It was. However, the time u...
#include <iostream> #include <queue> using namespace std; long long H, W, sx, sy, gx, gy, dist1[509][509], dist2[509][509]; char c[509][509]; int main() { cin >> W >> H; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { cin >> c[i][j]; dist1[i][j] = (1LL << 60); dist2[i][j] = (1LL << 60); if (c[...
Problem: Sanpo Problem Statement The cats love walking. There are new discoveries as you walk down the road. The town where Sora lives consists of N squares and N-1 roads. The road just connects the two squares and does not branch or intersect. For the road, the time t to walk, the upper limit m of the number of di...
#include <bits/stdc++.h> using namespace std; using ll = long long int; void chmax(ll &A, ll B) { A = max(A, B); } struct Edge { Edge() {} Edge(int to_, int tm_, int lim_, int cost_) : to(to_), tm(tm_), lim(lim_), cost(cost_) {} int to, tm, lim, cost; }; using Graph = vector< vector<Edge> >; ll N, T, dp...
Problem: Sanpo Problem Statement The cats love walking. There are new discoveries as you walk down the road. The town where Sora lives consists of N squares and N-1 roads. The road just connects the two squares and does not branch or intersect. For the road, the time t to walk, the upper limit m of the number of di...
#include <cstdio> #include <vector> #include <deque> using namespace std; const int MAX_N = 300; const int MAX_W = int(1e4); const int INF = int(1.05e9); //^@本当にこれで大丈夫? template<typename numType> inline bool updateMax(numType& old, const numType& test) { if (old < test) { old = test; return true; } return fals...
Problem: Sanpo Problem Statement The cats love walking. There are new discoveries as you walk down the road. The town where Sora lives consists of N squares and N-1 roads. The road just connects the two squares and does not branch or intersect. For the road, the time t to walk, the upper limit m of the number of di...
#include<cstdio> #include<vector> #include<algorithm> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; const int INF=1<<29; const int V_MAX=300; const int E_MAX=V_MAX-1; const int T_MAX=10000; struct edge{ int v,cost,capa,val; }; int n; vector<edge> G[V_MAX]; // tree vector< pair<edge,int> > order; /...
Problem: Sanpo Problem Statement The cats love walking. There are new discoveries as you walk down the road. The town where Sora lives consists of N squares and N-1 roads. The road just connects the two squares and does not branch or intersect. For the road, the time t to walk, the upper limit m of the number of di...
#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <iostream> #include <complex> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <functional> #include <cas...
Problem: Sanpo Problem Statement The cats love walking. There are new discoveries as you walk down the road. The town where Sora lives consists of N squares and N-1 roads. The road just connects the two squares and does not branch or intersect. For the road, the time t to walk, the upper limit m of the number of di...
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long LL; struct Edge { int to, t, m; LL v; }; void dfs(int v, int parent, const vector<vector<Edge>> &graph, vector<pair<int,Edge>> &ord) { for(const auto &e : graph[v]) { if(e.to == parent) continue; ...
Problem: Taro loves a game called Vongress. Vongress is a camp game played on a board that is a convex polygon consisting of n vertices. In this game, m players place one piece each inside the board. The position of the piece is represented by a set of x-coordinate and y-coordinate, and the size of the piece is not co...
#include <cstdio> #include <cmath> #include <cstring> #include <cstdlib> #include <climits> #include <ctime> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <set> #include <map> #include <iostream> #include <deque> #include <complex> #include <string> #include <iomanip>...
Problem: Taro loves a game called Vongress. Vongress is a camp game played on a board that is a convex polygon consisting of n vertices. In this game, m players place one piece each inside the board. The position of the piece is represented by a set of x-coordinate and y-coordinate, and the size of the piece is not co...
#include <cstdio> #include <cmath> #include <cstring> #include <cstdlib> #include <climits> #include <ctime> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <set> #include <map> #include <iostream> #include <deque> #include <complex> #include <string> #include <iomanip>...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<iostream> using namespace std; int main(){ int a,n,d,c=0; cin >> n >> d; for(int i=0;i<n;i++) { cin >> a; if(a>d)c+=a-d; } if(c==0)cout << "kusoge" << endl; else cout << c << endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; int main(){ int n,d; cin >> n >> d; int ans = 0; for(int i = 0 ; i < n ; i++){ int p; cin >> p; ans += max(0,p - d); } if( ans == 0 ){ cout << "kusoge" << endl; }else{ cout << ans << endl; } }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int,int>; #define enld '\n' #define rep(i,n) for(int i=0; i<(n); i++) #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("Ofast") constexpr ll INF = 1e18; constexpr int inf = 1e9; constexpr ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<iostream> using namespace std; int n,d,p,sum; int main(){ cin>>n>>d; for(int i=0;i<n;i++){cin>>p;if(p>=d)sum+=(p-d);} if(sum==0)cout<<"kusoge"<<endl; else cout<<sum<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int n,d,p,ans; int main(){ cin>>n>>d; while(n--){ cin>>p; ans+=max(0,p-d); } if(!ans)cout<<"kusoge"<<endl; else cout<<ans<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> using namespace std; int main(){ int n,d,p,total=0; cin >> n >> d; for (int i=0;i<n;i++) { cin >> p; if (p>d) total += p-d; } if (total == 0) cout << "kusoge" << endl; else cout << total << endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
n, d = map(int, input().split()) lst = list(map(int, input().split())) ans = sum([x - d for x in lst if x - d >= 0]) print(ans if ans else "kusoge")
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main() { int N, D; cin >> N >> D; int ret = 0; for(int i = 0; i < N; i++) { int P; cin >> P; ret += max(0, P - D); } if(ret == 0) cout << "kusoge" << endl; else cout << ret << endl; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int d = sc.nextInt(); int[] p = new int[n]; for(int i=0;i<n;i++) { p[i] = sc.nextInt(); } int score = 0; for(int i=0;i<n;i++) { int s = p[i] - d; ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> using namespace std; int main(){ int N,d; cin>>N>>d; int ans=0; for(int i=0;i<N;i++){ int p; cin>>p; if(p>d)ans+=p-d; } if(ans)cout<<ans<<endl; else cout<<"kusoge"<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define pri...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <stdio.h> int main(void){ int n, d, i, j, ans = 0; scanf("%d%d", &n, &d); int p[n]; for(i = 0; i < n; ++i) { scanf("%d", &p[i]); p[i] -= d; } for(i = 0; i < n; ++i) if(p[i] > 0) ans += p[i]; if(ans > 0) printf("%d\n", ans); else printf("kusoge\n"); return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> #include <vector> #include <string> #include <set> #include <queue> #define rep(i,a) for(int i = 0 ; i < a ; i ++) using namespace std; int main(void){ int n,ret = 0,in,d; cin>>n>>d; rep(i,n){ cin>>in; ret += (in>d?in-d:0); } if(ret==0){ cout<<"kusoge"<<endl; }else{ co...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
import java.util.Scanner; /** * Yamanote-line Game */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line; int N, d; N = sc.nextInt(); d = sc.nextInt(); int ans = 0; for (int i = 0; i < N; i++) { ans += Math.max(sc.nextInt() - d, 0); }...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) const double PI = 3.1415926535897932384626433832795028841971; const int INF = 1000000007; const double EPS = 1e-10; const int MOD = 1000000007; using namespace std; typedef long long ll; typedef pair<int,int> P; typedef pair<int,P> PP; int n, ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (int)(n); ++i) int main(){ int n; while(cin >> n){ int d; cin >> d; int a[1001]; rep(i,n) cin >> a[i]; sort(a,a+n); reverse(a, a+n); int ans = 0; for(int i = 1; i <= n; ++i)...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; int main() { int n, d; scanf("%d%d", &n, &d); int sum = 0; rep(i, n) { int p; scanf("%d", &p); if (p > d)sum += p - d; } if (sum == 0)puts("kusoge"); else printf("%d\n", sum); }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; #define lp(i,n) for(int i=0;i<n;i++) int main(){ int n,a; cin>>n>>a; int memo; int ans=0; lp(i,n){ cin>>memo; if(memo>a) ans+=memo-a; } if(ans<=0) cout<<"kusoge"<<endl; else cout<<ans<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; int main(){ int n,d,p; cin >> n >> d; int sum=0; for(int i=0;i<n;i++){ cin >> p; if(p-d>0)sum+=p-d; } if(sum>0)cout << sum << endl; else cout << "kusoge\n"; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main() { int N, D; cin >> N >> D; int ret = 0; for(int i = 0; i < N; i++) { int P; cin >> P; ret += max(P - D, 0); } if(ret == 0) { cout << "kusoge" << endl; } else { cout << ret << endl; } }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main(){ int N, d, p, a = 0; cin>>N>>d; for(int i = 1; i <= N; i++){ cin>>p; if(p-d > 0)a += p-d; } if(a >= 1) cout<<a<<endl; else cout<<"kusoge"<<endl; return 0; } //9:24
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main(){ int N,d,ans=0; int p[1000]; cin>>N>>d; for(int i=0;i<N;i++){ cin>>p[i]; ans+=max(0,p[i]-d); } if(ans>0) cout<<ans<<endl; else cout<<"kusoge"<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; int main(void){ int N, d; cin >> N >> d; int p = 0; int ans = 0; for(int i = 0; i < N; i++){ cin >> p; ans += max(0, p-d); } if(ans == 0){ cout << "kusoge" << endl; }else{ cout << ans << endl; } return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
// g++ -std=c++11 a.cpp #include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<random> #include<cstring> #include<queue> #include<stack> #include<bitset> #include<cstdio> #include<sstream> #include<iomanip> #include<assert.h> #inc...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
import java.util.Scanner; public class Main { void run() { try (Scanner sc = new Scanner(System.in)) { int n = Integer.parseInt(sc.next()); int d = Integer.parseInt(sc.next()); int sum = 0; for (int i = 0; i < n; i++) { int p = Integer.parseInt(sc.next()); if (p > d) { sum += (p - d); ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 29) using namespace std; int main(){ int n, d, p[1001]; int ans = 0; cin >> n >> ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
/* -*- coding: utf-8 -*- * * 2799.cc: Yamanote-line 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> #inc...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main(){ int n; int d; cin >> n >> d; int yen; int sum=0; for(int i=0;i < n;i++){ cin >> yen; if( yen > d){ sum += yen - d; } } if(sum == 0){ cout << "kusoge" << endl; } else{ cout << sum << endl; } return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include "bits/stdc++.h" #define REP(i,a,b) for(i=a;i<b;++i) #define rep(i,n) REP(i,0,n) #define ll long long #define ull unsigned ll typedef long double ld; #define ALL(a) begin(a),end(a) #define ifnot(a) if(not a) #define dump(x) cerr << #x << " = " << (x) <...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
/* template.cpp [[[ */ #include <bits/stdc++.h> using namespace std; #define get_macro(a, b, c, d, name, ...) name #define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__) #define rep1(n) rep2(i_, n) #define rep2(i, n)...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; // macro #define rep(i,n) for(i=0;i<n;i++) #define ll long long #define all(v) v.begin(), v.end() // code starts int main() { int n,d;cin>>n>>d; vector<int> p(n); int i; rep(i,n)cin>>p[i]; rep(i,n)p[i]-=d; int ans=0; rep(i,n) { if(p[i]>0)ans+=p[i]; } ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i,n) for (int i = 0; i < (n); ++i) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;++i) int main(void){ int N,d,p,res=0; cin>>N>>d; rep(i,N){ cin>>p; res+=max(0,p-d); } if(res==0)cout<<"kusoge"<<endl; else cout<<res<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int N; int main(){ int d; cin >> N >> d; int res = 0; for(int i=0;i<N;i++){ int a; cin >> a; if( a > d ) res += a-d; } if( !res ) cout << "kusoge" << endl; else cout << res << endl; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> #include <vector> #include <algorithm> #define rep(i,n) for(int i = 0; i<n; i++) using namespace std; int main(){ int n,d; cin >> n >> d; int r = 0; vector<int>v(1010,0); rep(i,n) cin>>v[i]; sort(v.begin(),v.end(),greater<int>()); if(v[0] <= d) { cout << "kusoge...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define repr(i, n) REPR(i, n, 0) #define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--) #define pb push_back #define all(r) r.begin(),r.end() #define rall(r) r.rbegin(),r.rend() #def...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#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...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main(){ ios_base::sync_with_stdio(false); int n, d; cin >> n >> d; vector<int> a(n); for(int i = 0; i < n; ++i){ cin >> a[i]; } int answer = 0; for(int i = 0; i < n; ++i){ if(a[i] > d){ answer += a[i] - d; }...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<iostream> using namespace std; int main(){ int n, d; cin >> n >> d; int score = 0; for(int i = 0; i < n; i++){ int x; cin >> x; score += max(0, x-d); } if(score == 0) cout << "kusoge" << endl; else cout << score << endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,d; cin >> n >> d; vector<int> a(n); for(int i=0; i<n; i++){ cin >> a[i]; } int ans = 0; for(int i=0; i<n; i++){ if(a[i]-d > 0){ ans += a[i]-d; } } i...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i=0;i<(n);i++) signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int N, d; cin >> N >> d; vector<int> p(N); rep(i, N) cin >> p[i]; int smdiff = 0; rep(i, N) { smdiff...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <map> #include <memory> #include <numeric> #include <ostream> #include <queue> #inc...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<iostream> using namespace std; int main() { int n, d, a, sum = 0; cin >> n >> d; for( int i = 0; i < n; i++ ) { cin >> a; a < d ? : sum += a - d; } if( sum == 0 ) cout << "kusoge" << endl; else cout << sum << endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <iostream> #include <algorithm> #define MAX_N 1000 using namespace std; int N,d; int main(void){ int res = 0; int x; cin >> N >> d; for(int i=0;i<N;++i){ cin >> x; res += x > d ? x - d : 0; } if(res>0) cout << res << endl; else cout << "kusoge" << endl; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main(){ int n,d,a,ans=0; cin>>n>>d; for(int i=0;i<n;i++){ cin>>a; ans+=max(0,a-d); } if(ans==0)cout<<"kusoge"<<endl; else cout<<ans<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> typedef long long int ll; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000001 using namespace std; int main(){ int N,d,sum = 0,tmp; scanf("%d %d",&N,&d); for(int i = 0;...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) #define ALL(A) A.begin(), A.end() using namespace std; typedef long long ll; typedef pair<int, int> P; int p[1005]; int main() { memset(p, 0, sizeof(p)); ios_base::sync_with_stdio(0); cin.tie(0); int N, D; cin >> N >> D; rep (i, N) cin >> p[i]; ...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> #define rep(i,n) for(int i=0; i<n; i++) using namespace std; int main(){ int n,d,p; int ans=0; cin >> n >> d; vector<int> v; rep(i,n){ cin >> p; if(p>d)v. push_back(p-d); } if(v.empty() == 0) { rep(i,v.size()){ ans += v[i]; } cout << ans << endl; } el...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n,d; cin >> n >> d; vector<int> p(n); for(int i=0;i<n;i++) cin >> p[i]; sort(p.begin(), p.end()); int ans = 0; for(int i=0;i<n-1;i++){ if(p[i]-d > 0) ans += p[i]-d; } ans += p[n-1]-d; if(ans > 0) cout...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include <cstdio> using namespace std; int N, D; int P[1000]; int main(){ scanf("%d %d", &N, &D); int ans = 0; for(int i = 0; i < N; i++){ scanf("%d", &P[i]); if(P[i] > D){ ans += P[i] - D; } } if(ans > 0){ printf("%d\n", ans); }else{ printf("kusoge\n"); } }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main(){ int n,d,an=0; cin>>n>>d; for(int i=0,a;i<n;i++){ cin>>a; an+=max(0,a-d); } if(an)cout<<an<<endl; else cout<<"kusoge"<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; int main(){ int N,d,p[1000]={},f=0,ans=0; cin>>N>>d; for(int i=0;i<N;i++)cin>>p[i]; for(int i=0;i<N;i++)if(p[i]>d)ans+=p[i]-d; if(ans>0)cout<<ans<<endl; else cout<<"kusoge"<<endl; return 0; }
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); int n,w; cin>>n>>w; int a[n]; int ans = 0; for(int i=0;i<n;i++){ cin>>a[i]; a[i] -= w; if(a[i] > 0) ans +=...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; typedef vector<...
Problem: B: Yamanote-line Game-Yamanote-line Game- Bean (?) Knowledge The Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, you must be careful about the valid time of the ticket. It seems safe with an IC card. Taking ...
import java.util.Scanner; public class Main { Scanner cin; int N,d; public void solve() { cin = new Scanner(System.in); N = cin.nextInt(); d = cin.nextInt(); int sum = 0; for(int i = 0;i < N;i++){ int p = cin.nextInt() - d; sum += Math.max(0, p); } System.out.println(sum == 0 ? "kusoge" : sum); ...