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 |
|---|---|---|---|---|---|
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
using namespace std;
const int MOD = 256;
const double EPS = 1e-7;
const int INF = 1<<29;
int n,I[257],R[257],O[257];
vector<int> sharp;
bool equal(double a, double b){
return fabs(a-b) < EPS;
}
void makeR(... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <math.h>
#include <vector>
using namespace std;
#define rep(i, e) for( int i = 0; i < e; i++ )
#define eps 1e-10
typedef vector<int> vec;
int main(){
int N, M = 256;
while( cin >> N, N){
vec I(N);
rep(i, N) cin >> I[i];
int S, A, C;
double H = 10000... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
typedef long double Double;
int main() {
typedef pair<int, int> Pii;
typedef pair<int, Pii> Piii;
int N; int const M = 256;
while(cin >> N && N) {
vector<int> I(N);
rep(i, N) ... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
typedef long double elm;
const elm inf = 1e100;
const int M = 256;
int N;
vector<int> I;
int cnt[M];
elm test(int s, int a, int c) {
fill(cnt, cnt+M, 0);
int r = s;
for(int i = 0; i < N; ++i) {
r = (a*r+c) % M;... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#inc... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<math.h>
#define MOD 256
using namespace std;
int main(){
int n;
int i,j,k,l;
int s,a,c,bs,ba,bc;
int r[16][16][16][260];
for(s=0;s<16;s++){
for(a=0;a<16;a++){
for(c=0;c<16;c++){
r[s][a][c][0]=s;
for(i=0;i<260-1;i++){
r[s][a][c][i+1]=(a*r[s][a][c][i]+c)%MOD;
}
... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
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.0);
#define REP... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<cmath>
#include<vector>
using namespace std;
int R[16][16][16][256]={0};
int main(){
for(int S=0;S<=15;S++){
for(int A=0;A<=15;A++){
for(int C=0;C<=15;C++){
R[S][A][C][0]=S;
for(int i=1;i<256;i++){
R[S][A][C][i]=(A*R[S][A][C][i-1]+C)%256;
}
}
}
}
int n;
wh... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
const double EPS = 1e-9;
const int INF = 10000000;
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
typedef long long ll;
using namespace std;
int m... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
const int MAX_N = 256;
const int M = 256;
int N, S, A, C;
int I[MAX_N + 10], R[MAX_N + 10], O[MAX_N + 10];
int main()
{
while (cin >> N, N) {
for (int i = 1; i <= N; ++i)
cin >> I[i];
S = A = C... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<cstring>
#include<map>
#include<cmath>
#include<vector>
using namespace std;
#define EPS 1e-10
double entropy(int s,int a,int c,vector<int> v){
map<int,int> mp;
for(int i=0;i<v.size();i++){
s = (a*s+c)&255;
++mp[(s+v[i])&255];
}
map<int,int>::iterator it;
double res=0,n=v.size();
... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
#define EPS 1e-10
double entropy(int s,int a,int c,vector<int> v){
int freq[256]={};
for(int i=0;i<v.size();i++){
s = (a*s+c)&255;
freq[(s+v[i])&255]++;
}
double res=0,n=v.size();
for(int i=0;i<256;i++){
if(!freq[i])c... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n,l[300],u[300];
while(cin >> n,n){
for(int i=0;i<n;i++)cin >> l[i];
double m = 1e10;
int x,y,z;
for(int s=0;s<16;s++){
for(int a=0;a<16;a++){
for(int c=0;c<16;c++){
for(int i=0;i<256;i++)u[i]... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).su... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <cmath>
using namespace std;
int main() {
ios::sync_with_stdio(false);
const int M = 256;
int N;
while (cin >> N && N) {
int I[256];
for (int i=1; i<=N; ++i) cin >> I[i];
double Hmin = 1000.0;
int s, a, c, upper = N;
for (int S=0; S<=15; ++S) {
for (int A=0; A<=15; ++A... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
double entropy(int N, const vector<int> &x) {
double H = 0;
for (int i=0; i<256; ++i) {
if (x[i] != 0) {
H -= (double)x[i] / N * log((double)x[i] / N);
}
}
return H;
}
int main() ... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
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)
#... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <cstdio>
#include <cstring>
#include <cmath>
#define mod 256
int n;
int l[258];
int r[16][16][16][258];
int cnt[258];
int main(void){
for(int s=0;s<=15;s++){
for(int a=0;a<=15;a++){
for(int c=0;c<=15;c++){
r[s][a][c][0]=s;
for(int q=1;q<=256;q++){
r[s][a][c][q]=(a*r[s][a][c][q-1]+c)%mod;
... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
using namespace std;
const int M = 256;
int x[256];
double entropy(int N) {
double H = 0;
for (int i=0; i<256; ++i) {
if (x[i] != 0) {
H -= (double)x[i] / N * log((double)x[i] / N);
}
}
return H;
}
... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;
int N;
void func(){
double minimum = (double)BIG_NUM,tmp;
int ans_S,ans_A,ans_C,M=256,R[N+1],input[N+1],O[N+1],check[256];
for(int... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main() {
while( true ) {
long long int n;
cin >> n;
if ( n == 0 ) break;
vector< long long int > v;
for ( long long int i = 0; i < n; i++ ) {
long long int in;
cin >> in;
v.pu... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<bits/stdc++.h>
#define M 256
#define EPS 1e-9
using namespace std;
int n,R[M],I[M],O,x[M];
double ans;
int ansS,ansA,ansC;
void ROcalc(int S,int A,int C){
R[0]=S;
for(int i=1;i<=n;i++) R[i]=(A*R[i-1]+C)%M,O=(I[i]+R[i])%M,x[O]++;
}
void Hcalc(int S,int A,int C){
double H=0;
for(int i=0;i<M;i++)if(x[i... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | //#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#defi... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define FOR(it,c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end();++it)
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
const int mod = 256;
for(int n; cin >> n, n;) {
v... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <cmath>
#include <iostream>
using namespace std;
int n, a[256];
int main() {
while (cin >> n, n) {
for (int i = 0; i < n; i++) cin >> a[i];
int mi, mj, mk; double v = 1e+300;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
for (int k = 0; k < 16; k++) {
int b[257] = { 0 }, c[25... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const double EPS=1e-9;
int main(){
const int M=256;
for(int N;scanf("%d",&N),N;){
int I[257];
for(int i=1;i<=N;i++) scanf("%d",I+i);
int Smin,Amin,Cmin;
double Hmin=1e30;
rep(S,16)rep(A,16)rep(C,16){
int R[2... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
const int MAX=256;
const double EPS=1e-6;
int N,S,A,C,R; double M,e,t;
vector<int> I(MAX);
map<int,int> cnt;
void solve(){
M=1e9;
for (int s=0;s<=15;++s){
for (int a=0;a<=15;++a){
for (int c=0;c<=15;++c){
R=s; e=0;
... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #define _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")
#include "bits/stdc++.h"
using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define ... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;
#define repl(i,a,b) for(i... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(a) "(" << #a << ": " << (a) << ")"
templa... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<cmath>
using namespace std;
int n, I[1 << 10], R[1 << 10], O[1 << 10], V[1 << 10];
int main() {
while (true) {
cin >> n; if (n == 0)break;
for (int i = 1; i <= n; i++) { cin >> I[i]; }
long double minx = 100.0; int T = 0;
for (int S = 0; S < 16; S++) {
for (int A = 0; A < 16; A++... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
while(true) {
int N = stdIn.nextInt();
if(N == 0) break;
int[] I = new int[N+1];
for(int i = 1; i <= N; i++) {
I[i] = stdIn.nextInt();
}
int M = 256;
int S = 99999999;... | JAVA |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(void)
{
for(;;){
int n;
cin >> n;
if(!n) return 0;
vector<int> l;
double H=1e+5;
l.resize(n);
... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 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 |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<iostream>
#include<string.h>
#include<math.h>
#define M 256
using namespace std;
int main()
{
int N;
while (cin >> N && N != 0)
{
int L[M];
for (int i = 0; i < N; i++)
{
cin >> L[i];
}
int ansS = 0, ansA = 0, ansC = 0;
double minH = 1e10;
for (int s = 0; s <= 15; s++)
{
for (int a = 0... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 7 | 0 | #include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
int b[256];
int c[256];
int d[256];
int main(){
int a;
while(scanf("%d",&a),a){
for(int i=0;i<a;i++){
scanf("%d",b+i);
}
int S=0,A=0,C=0;
double min=999999999;
for(int i=0;i<16;i++){
for(int j=0;j<16;j++){
for(int k=0;k<16... | CPP |
p01283 Strange String Manipulation | A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | 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 |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
usi... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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[][... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <cstdio>
#include <utility>
#include <queue>
#include <iostream>
using namespace std;
int main(){
int W, H, gx, gy, sx, sy, n = 0;
cin >> W >> H;
string M[H];
vector< pair<int,int> > springs;
for(int i = 0; i < H; ++i){
cin >> M[i];
for(int j = 0; j < W; ++j){
if(M[i][j] == 'g'){
gx =... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <vector>
#include <iostream>
#include <queue>
#include <cassert>
#include <tuple>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> PD;
typedef long double ld;
const int MN = 550;
const int INT_INF = 1<<28;
const int d4[4][2] = {
{0, 1},
{1, 0},
{0,... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;
#define fr first
#define sc second
#... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#ifdef _WIN32
#define scanfll(x) scanf("%I64d", x)
#define printfll(x) printf("%I64d", x)
#else
#define scanfll(x) scanf("%lld", x)
#define printfll(x) printf("%lld", x)
#endif
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | // #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define fi first
#define se second
const ll INF = 1e15;
int W, H;
vect... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
int main(){
int w,h;
cin>>w>>h;
vector<string> c(h);
const long long int INF=1e15;
vector<vector<long long int>> spr(h,vector<long long int>(w,INF));
queue<pair<int,int>> que;
pair<int,int> s;
pair<int,int> g;
for(int i=0;i<h;i++){
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <queue>
#include <string>
#include <iomanip>
#include <iostream>
#pragma warning(disable : 4996)
using namespace std;
struct state {
int x, y; long double dist;
};
bool operator<(const state& s1, const state& s2) {
return s1.dist < s2.dist;
}
int dir[4] = { 0, 1, 0, -1 };
int H, W, sx, sy; long double dist[5... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <cstdio>
#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 ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | // #ifdef DEBUG
// #define _GLIBCXX_DEBUG
// #endif
#include <iostream>
#include <cassert>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <funct... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <tuple>
#include <functional>
#include <cstdio>
#include <cmath>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
template <class T> bool setmax(T & l, T const & r) { if (not (l < r)) return false; l = r; return true; }
template <class ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<iostream>
#include<algorithm>
#include<queue>
#include<tuple>
using namespace std;
#define int long long
char c[523][523];
template<class A>
void bfs(A &ds,queue<tuple<int,int,int> > que){
fill(*begin(ds),*end(ds),1e9);
while(!que.empty()){
auto cs=que.front();
que.pop();
int t=get<0>(cs);
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <queue>
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long Weight;
const Weight INF = 1000000000000ll;
struct Edge{
int src, dest; Weight weigh... | CPP |
p01453 Spring Tiles | 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 until the ... | 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 |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <cstdio>
#include <utility>
#include <queue>
#include <iostream>
using namespace std;
int main(){
int W, H, gx, gy, sx, sy, n = 0;
cin >> W >> H;
string M[H];
vector< pair<int,int> > springs;
for(int i = 0; i < H; ++i){
cin >> M[i];
for(int j = 0; j < W; ++j){
if(M[i][j] == 'g'){
gx = ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <algorithm>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
struct edge { int v, w; };
ll INF = LLONG_MAX / 2;
int dy[] = {0, -1, 0, 1};
int dx[] = {-1, 0, 1, 0};
int... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const lon... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
namespace {
typedef long double real;
typedef long long ll;
template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
if (vs.empty()) return os << "[]";
os << "[" << vs[0];
for (int i = 1; i < vs.size(); i++) os << " "... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#defi... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | // #ifdef DEBUG
// #define _GLIBCXX_DEBUG
// #endif
#include <iostream>
#include <cassert>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <funct... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<io... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr int dir[5] = {0, 1, 0, -1, 0};
int main()
{
ll W, H;
cin >> W >> H;
vector<vector<char>> field(H, vector<char>(W));
P s, g;
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
constexpr long long INF = (1ll << 50);
void bfs(int sx, int sy, const vector<string> &field, vector<vector<long long>> &dist) {
typedef pair<int, int> point;
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int H, W;
vector<string> fi;
using pint = pair<int,int>;
void bfs(queue<pint> &que, vector<vector<int> > &dist) {
while (!que.empty())... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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++){
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <set>
#include <cstdio>
#include <queue>
#include <algorithm>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
using namespace std;
int w, h;
char g[512][512];
int sx, sy;
int gx, gy;
int all;
int dg[512][512]... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define inf (int)(1e18)
#define int long long
#define double long double
signed main(){
int H, W, i, j, v;
scanf("%lld%lld", &W, &H);
vector<string> c(H);
int sx, sy, floor = 0;
queue<pair<pair<int, int>, int>> q1, q2;
for(i = 0; i < H; i++){
cin >> c[i];
for(j =... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H,W;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
char t[500][500];
ll A[500][500],B[500][500];
ll INF=(1LL<<50);
void bfs(char ch,ll d[500][500]){
fill(d[0],d[500], INF );
queue<int> qy,qx;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | // #ifdef DEBUG
// #define _GLIBCXX_DEBUG
// #endif
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <co... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
const int inf=1e9;
const int64_t inf64=1e18;
c... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <cstdio>
#include <queue>
#include <cmath>
#include <cstring>
#include <algorithm>
#define INF 1e18
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
int fie[510][510];
int dist[2][510][510];
int w,h;
vector<PP> vec;
int sx,sy,gx,gy;
typedef lon... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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[][... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<algorithm>
using namespace std;
class C{
public:
int x,y;
C(int x,int y):x(x),y(y){}
};
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
int w,h;
bool in(int x,int y){
if(x<0 || y<0 || x>=w || y>=h) return false;... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr int INF = 1e9;
constexpr int dx[4] = {0, 1, 0, -1};
constexpr int dy[4] = {1, 0, -1, 0};
int main() {
int W, H;
cin >> W >> H;
vector<string> v(H);
int s, g;
int fc... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | //?????°???????????????????????£???????????£???(orz)
#include <iostream>
#include <algorithm>
#include <queue>
#include <tuple>
#include <vector>
#include <cstdio>
#include <string>
#define int long long
using namespace std;
typedef tuple<int, int, int> T;
const int dy[4] = {-1, 0, 1, 0};
const int dx[4] = {0, 1, 0, -... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<io... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <tuple>
#include <functional>
#include <cstdio>
#include <cmath>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
template <class T> bool setmax(T & l, T const & r) { if (not (l < r)) return false; l = r; return true; }
template <class ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<bits/stdc++.h>
/*
*/
using namespace std;
typedef pair<long long int, pair<long long int, long long int>>one;
#define mod 1000000007LL
int main() {
long long int W, H;
cin >> W >> H;
vector<string>D( H );
long long int counttile = 0;
pair<long long int, long long int>start, goal;
vector<pair<long long... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define MP make_pair... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#includ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
using namespace std;
const int inf = 1e9;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
void bfs_grid(queue<pair<int,int>> &wait, vector<string> &g, vector<vector<int>> &res){
while(!wait.empty()){
int y = ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
new Main().solver();
}
int[] dx = { 1, -1, 0, 0 };
int[] dy = { 0, 0, 1, -1 };
char[][] table;
long INF = 1L << 50;
int h, w;
void solver(... | JAVA |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))
#define PB push_back
#define mkp make_pair
#define F first
#define S second
#define INF 0x3f3f3f3f
#define EPS 1e-8
typedef vector<int> vint;
typedef pair<int,int> pii;
int main(){
int H,W;
c... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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 ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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[][... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H,W;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
char t[500][500];
ll A[500][500],B[500][500];
ll INF=(1LL<<50);
void bfs(char ch,ll d[500][500]){
fill(d[0],d[500], INF );
queue<int> qy,qx;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";els... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
struct cww{cww(){
ios::sync_with_stdio(false);cin.tie(0);
cout<<fixed<<setprecision(10);
}}init;
inline bool isWall(char c){return c=='#';}
inline bool isSpring(char c){return c=='*';}
inline bool isFloor(char c){return c=='.'||c=='s';}
inline bool isStart(char c)... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define ll long long
#define vl vector<ll>
#define vll vector<vl>
#define double long double
const int INF = 1e9;
const int di[] = {0, 1, 0, -1};
const int dj[] = {1, 0, -1, 0};
int w, h;
string s[500]... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
#define double long double
int main() {
constexpr double inf = 1e100;
cin.tie(nullptr); ios::sync_with_stdio(false);
int w, h; cin >> w >> h;
V<stri... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <cmath>
using namespace std;
#define rep(i, n) for(int i = 0; i< n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
typ... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define H 510
... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const dou... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #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[][... | CPP |
p01453 Spring Tiles | 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 until the ... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
const long double INF = 1e17;
#define PI (acos(-1))
//const ll mod = 1000000007;
int W, H;
string field[505];
int sh, sw, gh, gw;
long double dist[505][505];
struct query {
i... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.