Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<functional>
#include<iomanip>
using namespace std;
const int N = 16;
const double infty = 1e80;
struct state{
int cur;
int type;
int vis;
double cost;
state(int cur, int type, int vis, double cost):cur(cur),type... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<cmath>
#include<cstdio>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const double INF=1e77;
struct point{
double x,y;
point():x(0),y(0){}
point(double x,double y):x(x),y(y){}
point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
};
double abs(const poin... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #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);... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cassert>
#include<climits>
#include<map>
#include<set>
#include<iomanip>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS 1e-6
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define MAX 20
... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #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);... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <num... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 100000... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
const int inf = 1LL << 55;
const int mod = 1e9 + 7;
struct Point{
double x,y;
Point(){}
Point(d... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double X1[20];
double Y1[20];
double X2[20];
double Y2[20];
double dp[1<<14][14][2];
int main(){
int T=0;
int a;
while(scanf("%d",&a),a){
for(int i=0;i<a;i++)scanf("%lf%lf%lf%lf",X1+i,Y1+i,X2+i,Y2+i);
for(int i=0;i<(1<<a);i++)for(int j=0... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* c... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld= long double;
ld get_dis(const pair<ld,ld>&l,const pair<ld, ld>&r) {
return sqrt((l.first-r.first)*(l.first-r.first)+(l.second-r.second)*(l.second-r.second));
}
ld dfs(vector<vector<... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <bits/stdc++.h>
#define N 14
using namespace std;
int n;
typedef pair<double,double> P;
typedef pair<P,P> PP;
double X[N],Y[N],X2[N],Y2[N];
double dis(double x,double y,double x2,double y2){
return sqrt((x-x2)*(x-x2)+(y-y2)*(y-y2));
}
map<P,double> mem[1<<N];
double dfs(double x,double y,int bit){
if(b... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<bits/stdc++.h>
#define INF (1e9)
#define MAX_N 14
using namespace std;
typedef complex<double> P;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
int n;
double x,y;
double dp[(1<<MAX_N)][MAX_N*2];
vector<P> v;
int main(){
i... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const double INF = 1e12;
typedef complex<double> P;
int main(){
for(int rep=1; ; rep++){
int n;
cin >> n;
if(n==0) break;
vector<vector<P> > seg(n,... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <complex>
#include <vector>
#include <cmath>
using namespace std;
#define MAXN (14)
#define INF (1<<29)
#define X real()
#define Y imag()
typedef complex<double> P;
template<class T>
inline T Sq(T x) { return x*x; }
inline double getDist(P,... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #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>... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<double,double> P;
double D(P a, P b){return sqrt((a.F-b.F)*(a.F-b.F)+(a.S-b.S)*(a.S-b.S));}
int main() {
int n,tt=1;
while(cin >> n && n) {
P a[n][2];
for(int i=0; i<n; i++) {
for(int j=0; j<2; j++) cin >> a[i... | CPP |
p01239 Connect Line Segments | Your dear son Arnie is addicted to a puzzle named Connect Line Segments.
In this puzzle, you are given several line segments placed on a two-dimensional area. You are allowed to add some new line segments each connecting the end points of two existing line segments. The objective is to form a single polyline, by conne... | 7 | 0 | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n; long double sx[16], sy[16], tx[16], ty[16], dp[1 << 15][15][2];
long double dst(long double ax, long double ay, long double bx, long double by) {
return sqrt((ax - bx)*(ax - bx) + (ay - by)*(ay - by));
}
int main() {
int d = 0;
while ... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define mp make_pair
#define INF (1<<28)
inline void cmin(int &a, int b) { if(a>b) a = b; }
typedef pair<int, int>... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstring>
using namespace std;
#define MAX 10000
#define INF 1e9
typedef pair<int,int> P;
int ans, N;
vector<P> vec[MAX];
int dp[100][100];
int dist(int x1, int y1, int x2, int y2){
return abs(x1-x2) + abs(y1-y2);
}
int getN... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<queue>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
#include<map>
#define INF 1<<21
using namespace std;
typedef pair<int,int> P;
queue< P > houzyu[10005];
int w,h;
char maps[102][102][10];
int ruiseki[102][102];
int sx,sy,gx,gy;
int n=0;
int dp[105][105]={0};
in... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define P pair<int,int>
using namespace std;
int main(){
int w,h;
P g;
string s;
while( cin>>w>>h && (w|h) ){
vector<P> p[100*100];
map<int,int> mp;
int n=1, nodeN=1;
for( int i=0;i<h;i++ ){
for( int... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <sstream>
#include <algorithm>
using namespace std;
int dp[2505][2505];
int todig(string a)
{
stringstream ss(a);
int res;
ss >> res;
return res;
}
int main()
{
int W,H;
while(cin >> W >> H, W||H){
int gx,... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#def... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
static final int INF = 2000000;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scan... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int ABS(int a){return max(a,-a);}
char in[11];
int m[120][120];
vector<pair<int,int> >at[11000];
int dp[120][120];
int main(){
int a,b;
while(scanf("%d%d",&b,&a),a){
for(int i=0;i<11000;i++)at[i].clear();
int n=0;
for(int i=0;i<a;i++... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #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>
using namespace std;
#define ll long long
#d... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | //e
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <c... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cstring>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
using namespace std;
typedef pair<int, int> P;
const int INF = 1<<29;
int dist(P a, P b){
return abs(... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
#define pb push_back
using namespace std;
int dx[4]={1,0,0,-1};
int dy[4]={0,1,-1,0};
struct node
{
int x;
int y;
int dis;
};
int kyori(node a,node b)
{
return abs(a.x-b.x)+abs(a.y-b.y);
}
int main(void)
{
int w,h;
s... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
#define Y first
#define X second
signed main(){
int w,h;
while(cin>>w>>h,w||h){
string s[h][w];
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
cin>>s[i][j];
vector<P> v[50000];
int gy,gx,gd=0;
for(int i... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <stdlib.h>
using namespace std;
int main(){
int w, h;
int cost[100][100];
while(cin >> w >> h, w){
vector< vector< pair<int,int> > > vp(w*h);
string str;
int gx, gy;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin >>... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#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 all(in) in.be... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cl... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <utility>
using namespace std;
typedef pair<int,int> P;
vector<P> p[2502];
vector<int> dp[2502];
int w,h,x,y,v,n,max_n;
int i,j,k;
char s[9];
int diff(P p1,P p2) {return abs(p1.first-p2.first)+abs(p1.second-p2.second);}
int main() {
while... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int dis( P p , P p_ ){
return abs(p.first-p_.first)+abs(p.second-p_.second);
}
int to_i(string s){
int n=0;
for(int i=0 ; i < s.size() ; i++ ){
n = n*10 + s[i]-'0';
}
return n;
}
int main(){... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
vector<P> house[5000];
int sx,sy,gx,gy,n,w,h;
int memo[103][103];
int dfs(int next,int y,int x);
int manha(P a,P b);
int main(){
while(1){
cin>>w>>h;
if(w==0 && h==0) break;
n=0;
for(int i=0;i<5000;i++){
house[i].clear();
... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
typedef pair<int,int> pii;
inline int dist(const pii &p, const pii &q){
return abs(p.first - q.first) + abs(p.second - q.second);
}
int main(){
const int INF = 1000000000;
int w, h, x... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <queue>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
const vector<int> dir = { 1, 0, -1, 0 };
int H, W; string s[109][109];
int main() {
while (cin >> W >> H, H | W) {
int sx, sy, gx, gy, cnt = 0;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> s[i... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<vector>
#include<map>
#include<sstream>
#include<queue>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int MAX = 3001;
const int INF = (1<<25);
struct Node{
int rank,row,column;
bool operator < (const Node& n) const{
return rank < n.rank;
}
};
typedef pair<int... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;
#define REP(i,n) for(int i=... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #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... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
static final int INF = 2000000;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
TreeMap<Integer, LinkedList<Point>> map = new TreeMap<Integer, Li... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<cctype>
#include<cstdio>
#include<vector>
#include<cstdlib>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int INF=1<<29;
struct P{ int x,y,cost; };
int main(){
for(int w,h;scanf("%d%d",&w,&h),w;){
int B[100][100];
int sx,sy,gx,gy;
int lastdgt=0;
vector<P> dgt[10010];
rep(i,... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static final int MAX = 2500;
public static final int INF = Integer.MAX_VALUE / 2 - 1;
public s... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
vector<P>v[100001];
vector<int> dp[10001];
int get(string x){
int res=0;
r(i,x.size())res=res*10+(x[i]-'0');
return res;
}
int dist(P a,P b){
return abs(a.first-b.first)+abs(a.second-b.second);
}
string s;... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <memory.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int,P> PP... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>x[2500];
vector<int>dist[2500];
string S;int h,w;
int main(){
while(true){
cin>>h>>w;int gx,gy,cnt=0;if(h==0)break;
for(int i=0;i<2500;i++){x[i].clear();dist[i].clear();}
for(int i=0;i<w;i++){
for(int j=0;j<h;j++){... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<cassert>
using namespace std;
#define REP(i, b, n) for(int i = b; i<(int)n; i++)
#define rep(i, n) REP(i, 0, n)
const int N = 100;
typedef pair<int,int> pii;
const int inf = (1<<21);
const int LIM = 3000;
int ... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<vector>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<28)
#define MAX2 2510
using namespace std;
int h,w;
vector<int> vec[MAX2];
int dp[MAX2];
int getManhattan(int a,int b)
{
int x1 = a%w;
int y... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
const int INF =1e+8;
// 2 テァツつケテゥツ鳴禿」ツ?ョテ」ツδ榲」ツδウテ」ツδ湘」ツδε」ツつソテ」ツδウティツキツ敕ゥツ崢「, d = |x1-x2| + |y1-y2|
int dist( P p , P p_ ){
return abs(p.first-p_.first)+abs(p.second-p_.second);
}
int to_i(string... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<iostream>
using namespace std;
#define INF (1<<29)
struct st{
int x,y;
st(int x,int y){this->x=x;this->y=y;}
};
int W,H;
int co;
int gx,gy;
vector<st> G[2501];
int dp[2501][2501];
inline int ab(int a){ re... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
static final int INF = 2000000;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while(true){
int w = sc.nextInt();
int h = sc.nextInt();... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cl... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#in... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
using namespace std;
int h, w;
int sx, sy;
int gx, gy;
vector<int> x[3000];
vector<int> y[3000];
int n;
int memo[100][100];
int g[100][100];
int solve(int... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <clim... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define p pair<int,int>
#define P pair<p,int>
using namespace std;
int parse(string a) {
int b = 0;
for (char c : a)b = b * 10 + c - 48;
return b;
}
int main() {
int a, b;
while (cin>>b>>a, a | b) {
p G;
vector<P>d[20000];
int MAX = 0;... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;
typedef pair<int,int>P;
int F(P a,P b){return abs(a.first-b.first)+abs(a.second-b.second);}
int main()
{
int w,h,i,j,k,n,c;
char s[9];
vector<P>p[2502];
vector<int>d[2502];
P g;
while(scanf("%d%d",&w,&h),w... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef pair< int, int > Pi;
typedef pair< Pi, int > Pii;
#define dp second
const int INF = 1 << 30;
int dist( Pi a, Pi b){
return abs( a.first - b.first) + abs( a.second - b.second);
}
int main()
{
int w, h;
Pi goal;
while( cin >> w >> h, w){
vector< Pii > n... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<vector>
#include<cctype>
using namespace std;
int main(){
int w, h;
while(cin >> w >> h, w+h){
vector<int> xi[2525], yj[2525];
vector<vector<int>> dp(2525, vector<int>(2525,1<<30));
int gi = -1, gj = -1, ma = 0;
for(int i = 0; i < h; i++){
... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
int i,j,k;
int w,h;
while(cin>>w>>h,w||h){
i... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string.h>
#define X first
#define Y second
#define MP make_pair
typedef long long ll;
using namespace std;
cons... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
const int INF =1e+8;
// 2 点間のマンハッタン距離, d = |x1-x2| + |y1-y2|
int dist( P p , P p_ ){
return abs(p.first-p_.first)+abs(p.second-p_.second);
}
int to_i(string s){
int n=0;
for(int i=0 ; i < s.size... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
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... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;
int main()
{... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #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>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct P{
int x,y;
P(int x,int y):x(x),y(y){}
};
int n;
int w,h;
vector<P> o[2700];
//int dp[11111][11111];
int dp[2700][2700];
//int **dp;
//vector<int> dp[11111];
int solve(int ... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
P s,g;
typedef pair< P , P > Q;
int h,w,sx,sy,gx,gy,c,dx[]={0,1,0,-1},dy[]={1,0,-1,0},num[105][105];
bool used[2500][... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | while True:
w, h = map(int, input().split())
if w == 0:break
mp = [input().split() for _ in range(h)]
points = {}
for y in range(h):
for x in range(w):
if mp[y][x] == "S":
sx, sy = x, y
points[0] = [(x, y)]
elif mp[y][x] == "G":
gx, gy = x, y
elif mp[y][x] == "... | PYTHON3 |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <cstring>
#include <sstream>
#include <string>
#include <iostream>
using namespace std;
typedef pair<int,int> pii;
inline int dist(const pii &p, const pii &q){
return abs(p.first - q.first) + a... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
//The Legendary Sword
public class Main{
void run(){
Scanner sc = new Scanner(System.in);
for(;;){
int w = sc.nextInt();
int h = sc.nextInt();
if((w|h)==0)break;
int[][] map = new int[h][w];
List<... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
#define MAX_H 100
#define MAX_W 100
#define INF (1<<28)
bool isdigit(string s) {
for (int i = 0; i < s.size(); i++)
if (!isdigit(s[i]))
return false;
ret... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <cstring>
#include <sstream>
#include <string>
#include <iostream>
using namespace std;
typedef pair<int,int> pii;
inline int dist(const pii &p, const pii &q){
return abs(p.first - q.first) + abs(p.... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
static final int INF = 2000000;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
TreeMap<Integer, LinkedList<Point>> map = new TreeMap<Integer, Li... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include ... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <sstream>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> x[2550];
vector<int> y[2550];
map<int,int> memo[2550];
int sx,sy,gx,gy;
int n;
int f(int pos , int w){
if(memo[pos].count(w)) return memo[pos][w];
if(pos==n-1){
return 0;
}
int ans = 9... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
typedef long long int64;
const static int INF = 1 << 28;
typedef pair< int, int > Pi;
typedef pair< int, Pi > Pii;
int main()
{
int w, h;
while(c... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
#define INF 1<<21
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;
vector< P > houzyu[10005];
int w,h;
char maps[102][102][10];
int ruiseki[102][102];
int sx,sy,gx,gy;//スタートとゴールの座標
int n=0;//宝珠の最大値
int dp[105][105]={0};//メモ用
int memtan(int now,int x,int y);
int dist... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int W, H;
while (cin >> W >> H && W != 0) {
static vector<pair<int,int> > ps[3000];
for (int i = 0; i < 3000; i++) {
ps[i].clear();
}
pair<int,int> g;
int m = 0;
for (int i ... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, s, e) for(int i = (int)s; i < (int) e; i++)
#define rep(i, n) REP(i, 0 ,n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
#define pb push_back
#define mp nake_pair
typedef long long ll;
typ... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
vector<int>x[2502], y[2502];
int d[2502][2502];
int p;
int main() {
int w, h;
while (scanf("%d%d", &w, &h), w) {
rep(i, 2502) {
x[i].clear(); y[i].clear();
}
p = 1;//s->0,g->p
int gx, gy;
rep(i, h) {
rep(j, w) {
st... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
static final int INF = 2000000;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while(true){
int w = sc.nextInt();
int h = sc.nextInt();... | JAVA |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
using namespace std;
#defin... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<map>
#include<cassert>
#include<iomanip>
#include<queue>
#include<set>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<28)
#define MAX 100
#define MAX2 2510
using namespace std;
/*
stru... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<climits>
#include<vector>
#include<map>
using namespace std;
typedef pair<int,int>P; //<x,y>
int F(P a,P b){return abs(a.first-b.first)+abs(a.second-b.second);}
int main()
{
int w,h,i,j,k,n,c;
char s[9];
vector<P>p[2502];
vector<int>d[25... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | //56
#include<iostream>
#include<map>
#include<vector>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
struct P{
int x,y,t;
};
int main(){
for(int w,h;cin>>w>>h,w|h;){
int gx,gy;
map<int,vector<P> > m;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
string s;
cin>>s;
... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <s... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;
#define rep(i,n) for((i)=0; (... | CPP |
p01401 The Legendary Sword | Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon King decided to destroy the legendary sword first before launching ... | 7 | 0 | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* c... | CPP |
p01555 FizzBuzz | FizzBuzz is a game in which integers of 1 or more are spoken in order according to the following rules.
* "Fizz" when divisible by 3
* "Buzz" when divisible by 5
* "FizzBuzz" when divisible by both 3 and 5
* At other times, that number
An example of the progress of the game is shown below.
1, 2, Fizz, 4, Buzz,... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll toInt(string s) {ll 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<in... | CPP |
p01555 FizzBuzz | FizzBuzz is a game in which integers of 1 or more are spoken in order according to the following rules.
* "Fizz" when divisible by 3
* "Buzz" when divisible by 5
* "FizzBuzz" when divisible by both 3 and 5
* At other times, that number
An example of the progress of the game is shown below.
1, 2, Fizz, 4, Buzz,... | 7 | 0 | def calc_start(mid):
cnt = -1
i = 1
while 10 ** i < mid:
cnt += i * (10 ** i - 10 ** (i - 1))
fif = (10 ** i - 1) // 15 - (10 ** (i - 1) - 1) // 15
three = (10 ** i - 1) // 3 - (10 ** (i - 1) - 1) // 3
five = (10 ** i - 1) // 5 - (10 ** (i - 1) - 1) // 5
cnt += (three... | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.