prompt string | response string |
|---|---|
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
#define MX 101
using namespace std;
char mp[MX][MX];
short sx[MX][MX], sy[MX][MX];
short f[MX][MX][MX][MX];
short n, m, ex, ey;
void chmax(short& a, const short& b) {if(b > a) a = b;}
int main()
{
scanf("%hd%hd", &n, &m);
for(short i=1; i<=n; i++)
{
scanf("%s", mp[i]+1);
for(short j=... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
int n,m,sx,sy,pre_ver[111][111],pre_hor[111][111];
char s[111][111];
int dp[111][111][111... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<iostream>
#include<cstdio>
#include<cstring>
namespace wohaocaia
{
inline void check_max(int a,int &b){if(a>b)b=a;}
const int N=105;
int s[N][N],f[N][N][N][N];
int n,m,sx,sy;
int tl,tr,tu,td;
int got(){for(char c=getchar();;c=getchar())if(c=='o' || c=='.' || c=='E')return c;}
int min(int a,int b){return... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
int dp[2][101][101][101];
int H,W;
string bd[100];
int ei,ej;
int cs[2][101][101];
int main... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | import java.io.*;
import java.util.*;
public class Main {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
void solve() throws IOException {
int h = nextInt();
int w = nextInt();
char[][] f = new char[h][];
int ex = -1, ey = -1;
for (int i = 0; i < h; i++) {
f[i] = nextTok... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100
using namespace std;
char Map[MAXN+5][MAXN+5];
int n,m,ex,ey;
int sumr[MAXN+5][MAXN+5],sumc[MAXN+5][MAXN+5];
int dp[MAXN+5][MAXN+5][MAXN+5];
void Init()
{
memset(dp,-1,sizeof(dp));
}
int main()
{
Init();
scanf("%d %d",&n,&m);
for(int i=1;i<=n;i... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
int gi() {
int w=0;bool q=1;char c=getchar();
while ((c<'0'||c>'9') && c!=... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
inline void upmax(short &x,const short &y){if(y>x) x=y;}
const int N=105;
short f[N][N][N][N];
short sum1[N][N],sum2[N][N];
int n,m,tx,ty;
void gao()
{
int limu=tx-1,limd=n-tx,liml=ty-1,limr=m-ty;
for(int u=0;u<=limu;u++)
for(int d=0;d<=limd;d++)
... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int n,m,i,j,k,l,x,y;
short f[105][105][105][105],ans,s1[105][105],s2[105][105],z;
char s[105][105];
int main()
{
scanf("%d%d",&n,&m);
for(i=1;i<=n;++i)
{
scanf("%s",s[i]+1);
for(j=1;j<=m;++j)
{
s1[i][j]=s1[i][j-1]+(s... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nn 102
#define lf double
char buf[nn][nn];
int dp[2][nn][nn][nn];
int n,m;
int sum[nn][nn];
int get(int x1,int y1,int x2,int y2)
{
if(x1<1) x1=1;if(y1<1) y1=1;
if(x2>n) x2=n;if(y2>m) y2=m;
return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }
const int MAXN = 105;
int f[MAXN][MAXN][MAXN], row[MAXN][MAXN],... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int Maxn = 110;
int f[2][Maxn][Maxn][Maxn];
int n, m;
int stx, sty;
char s[Maxn][Maxn];
int a[Maxn][Maxn], row[Maxn][Maxn], col[Maxn][Maxn];
void up(int &x, int y) { if(x < y) x = y; }
int _max(int x, int y) { retur... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
template<class I> I chmax(I &x, I y) { return x < y ? x = y : x; }
template<class I> I chmin(I &x, I y) { return x > y ? x = y : x; }
char s[103];
short F[103][103][103][103];
short s1[103][103], s2[103][103];
int main()
{
int n, m, tx = 0, ty = 0;
scanf("%d%d", &n, &m)... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m, ex, ey;
short dp[N][N][N][N], s1[N][N], s2[N][N];
char s[N][N];
inline void up(short& x, short y) { x = (x < y ? y : x); }
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
for (int i = 1; i <= n... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a ; i <= b; ++ i)
const int N = 101, inf = 1e4 ;
using namespace std ;
int n, m ;
char a[N][N] ;
short f[N][N][N][N], sum[2][N][N] ;
void upd(short &x, short y) { if... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=100+10;
int f[maxn][maxn][maxn],sum[maxn][maxn];
int i,j,k,l,r,u,d,t,n,m,ex,ey,ans,up,down,left,right;
char ch;
char get(){
char ch=getchar();
while (ch!='.'&&ch!='o'&&ch!='E') ch=getchar();
return ch;
}
int ... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <iostream>
#define ri register int
using namespace std;
typedef long long LL;
const int N = 102;
char ch[N][N];
short le[N][N], up[N][N], dp[N][N][N][N];
inline void upd(short &x, short y) {
if (x < y) x = y;
}
int main() {
int n, m, ex, ey;
scanf("%d%d", &n, &m);
for (int i = ... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
inline void upmax(short &x,const short &y){if(y>x) x=y;}
const int N=105;short f[N][N][N][N],sum1[N][N],sum2[N][N];
int n,m,tx,ty;
void gao(){
int limu=tx-1,limd=n-tx,liml=ty-1,limr=m-ty;
for(int u=0;u<=limu;u++)for(int d=0;d<=limd;d++)for(int l=0;l<=liml;l++)for(int... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
int h, w;
char a[100][101];
int ex, ey;
int c[101][101];
int dp[100][100][100][100];
int box(int x, int y, int z, int w){
return c[z][w] - c[z][y] - c[x][w] + c[x][y];
}
int main(){
cin >> h >> w;
r... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | # include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>
# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#include<algorithm>
using namespace std;
const int N=102;
int i,j,k,n,m,ch,x,y,ans;
int a[N][N],A[N][N],B[N][N];
char s[N];
short f[N][N][N][N];
int main() {
scanf("%d%d",&n,&m);
for (i=1;i<=n;i++) {
scanf("%s",s+1);
for (j=1;j<=m;j++) {
if (s[j]=='o') a[i][j]=1;
if (s[j]=='E') x=i,y=j;
}... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=101;
char a[N][N];
int row[N][N],col[N][N],f[N][N][N][N];
int n,m,x,y;
inline void chk(int &a,int b){a=max(a,b);}
int main()
{
scanf("%d %d",&n,&m);
for(int i=1;i<=n;++i) scanf("%s",a[i]+1);
for(int i=1;i<=n;++i)
for(int ... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <algorithm>
const int maxn = 105;
using namespace std;
int n, m, ex, ey; char str[maxn][maxn];
short f[maxn][maxn][maxn][maxn], p[maxn][maxn], q[maxn][maxn];
short max(short x, int y){
if (x < y) return y;
return x;
}
int main(){
// freopen("1.in", "r", stdin);
// freopen("1.out", "w", std... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <queue>
using namespace std;
typedef short sh;
#define N 105
int n,m,sum[N][N];
char mp[N][N];
sh f[N][N][N][N];
inline void upd(sh &x,sh y) {x=x>y?x:y;}
int getsm(int x,int y,int z,int w) {
return sum[z][w]-sum[x-1][w]-sum[z][y-1]+s... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
const int MAXN = 110;
const int NINF = 0xcfcfcfcf;
char buf[MAXN];
int H, W, dp[2][MAXN][MAXN][MAXN];
int pre[MAXN][MAXN];
void getmax(int & x, int y) { x < y ? x = y : 0; }
struct M {
int l, r, u, d;
M(int a1, int a2, int a3, int a4) {
l = a1, r = a2, u = a3, d = a4;
}
} ;
inline int gm(... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
const int N = 102;
const short INF = 30000;
short dp[N][N][N][N],n,m,mat[N][N],px,py,ans;
char s[N];
short query(int u,int d,int l,int r) {
if (u > d || l > r) return 0;
return mat[d][r] - mat[u-1][r] - mat[d][l-1] + mat[u-1][l-1];
}
short calc(int u,int d,int l,int r,i... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
void chmax(int& a, int b){
a = max(a, b);
}
int main(){
int H, W;
cin >> H >> W;
string S[101];
S[0] = string('!', W+1);
int ER, EC;
for(int i=1; i<=H; i++){
cin >> S[i];
S[i].insert(0, "!");
if(S[i].find('E') != -1){
... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | // Do you knOW what it feels like?
// To be TorTured by your own MinD?
// I don't wanna feel the PAIN.
// I BeG you to KILL me, pleASE...
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")
#define F first
#define S seco... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
int line[110][110],col[110][110];
short dp[101][101][101][101];
int main()
{
int n,m,x,y;scanf("%d%d\n",&n,&m);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
{
line[i][j]=line[i][j-1];col[i][j]=col[i-1][j];
char ch=getchar();
if (ch=='E') {x=i;y=j;}
else if (ch==... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
char s[maxn][maxn];
int r[maxn][maxn], c[maxn][maxn];
int f[maxn * maxn >> 2][maxn * maxn >> 2];
int h, w, X, Y;
inline int encode(int l, int r, int M) {
return r * M + l;
}
inline void chkmax(int& x, int v) {
x = max(x, v);
}
int dfs(int lX,... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <algorithm>
#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
using namespace std;
const int N = 101;
char g[N][N];
short s[N][N];
short f[N][N][N][N];
void i... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); ++i)
#define per(i,a,b) for (int i=(a); i>=(b); --i)
using namespace std;
const int maxn = 105;
int f[maxn][maxn][maxn], s[maxn][maxn], n, m, sx, sy, ans;
char str[maxn];
inline void upd(int &x, int y) {
if (y > x) x = y;
}
inline int getr(int x, in... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
typedef short int i16;
typedef unsigned short int u16;
const int MAXN = 100 + 5;
int answer;
int N, M;
i16 ex, ey;
i16 row[MAXN][MAXN], col[MAXN][MAXN];
i16 dp[MAXN][MAXN][MAXN][MAXN];
char mp[MAXN][MAXN];
int main()
{
... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
using namespace std;
const int N=105;
char mp[N][N];
int n,m,ex,ey,ans;
int sr[N][N],sc[N][N];
int dp[N][N][N];
void mx(int &x,int y){
x<y?x=y:0;
}
int main(){
scanf("%d%d",&n,&m);
memset(dp,233,sizeof(dp));
For(i,1,n) scanf("%s",mp[i]+... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
template<typename T> void amax(T &a, T b){ a = max(a, b); }
const int maxn = 101;
short dp[maxn][maxn][maxn][maxn];
int acum[maxn][maxn];
char g[maxn][maxn];
int main(){
int n, m; cin >> n >> m;
int xe = -1, ye = -1;
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j+... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=110;
short dp[maxn][maxn][maxn][maxn];
int n,m, tx,ty, add;
short sumc[maxn][maxn], sumr[maxn][maxn], ans;
char s[maxn][maxn];
void chkmax(short& x,short y){ if(x<y) x=y; }
short calc(short* sum,int l,int r){
i... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int res,ll,rr,uu,dd,ad,R,L,D,U,sx,sy,h,w,pr[105][105],pc[105][105],dp[105][105][105];
char s[105][105];
int main()
{
scanf("%d%d",&h,&w);
for (int i=1;i<=h;++i)
scanf("%s",s[i]+1);
for (int i=1;i<=h;++i)
for (int ... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
string g[101];
short dp[101][101][101][101];
short px[101][101],py[101][101];
void update(short& x,short y){
x=max(x,y);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>g[i];
for(int i=1;i<=n;i++)
g[i].inse... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
const int N=110;
int h,w,px,py,f[N][N][N][N],col[N][N],row[N][N];
bool mp[N][N];
void Init()
{
scanf("%d%d",&h,&w);
for (int i=1;i<=h;++i)
for (int j=1;j<=w;++j)
{
char ch=getchar();
while (ch!='o' && ch!='.' && ch!='E') ch=getchar();
if (ch=='E') px=i,py... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
using namespace std;
#define RI register int
const int N=105;
char mp[N][N];
int f[2][N][N][N],a[N][N],n,m,sx,sy,ans;
int gets(int x1,int y1,int x2,int y2)
{return a[x2][y2]-a[x1-1][y2]-a[x2][y1-1]+a[x1-1][y1-1];}
int main()
{
scanf("%d%d",&n,&m);
for(RI i=1;i<=n;++i) {
scanf("%s",mp[i]+1);... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
int n,m,px,py,s1[107][107],s2[107][107],s3[107][107];
char s0[107][107];
short f[107][107][107][107],ans=0;
void maxs(short&a,int b){if(a<b)a=b;}
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;++i){
scanf("%s",s0[... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
#define dmax(x, y) x = max(x, y);
#define N 110
#define M 10000001
int n, m, addx, addy, ans;
int a[N][N], b[N][N], f[M];
char c[N];
inline int pos(int i, int j, int k, int l) {
return ((i * (n - addx + 1) + j) * addy + k) * (m - addy + 1) + l + 1;
}
int main() {
sc... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<stdio.h>
#include<iostream>
#include<algorithm>
#define N 105
using namespace std;
short line[N][N],list[N][N],ans[N][N][N][N],n,m,op,sx,sy;
char s[N][N];
int main()
{
cin>>n>>m;
for (short i=1;i<=n;i++) scanf("%s",s[i]+1);
for (short i=1;i<=n;i++) for (short j=1;j<=m;j++)
{
line[i][j... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
template<class T1, class T2>
void chmax(T1 &a, T2 b) {
if (a < b) a = b;
}
int h, w;
char g[101][101];
int sh[111][111], sv[111][111];
int main() {
cin >> h >> w;
int y, x;
for (int i = 0; i < h; i++) {
scanf("%s", g[i]);
for (int j = 0; j < w; j++) {
if (g[i... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define calc(xl,xr,yl,yr) (sum[xr][yr]-sum[xl-1][yr]-sum[xr][yl-1]+sum[xl-1][yl-1])
const int N=105;
int n,m,ex,ey,ans,sum[N][N],f[2][N][N][N];
char s[N][N];
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%s",s[i]... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<bits/stdc++.h>
#define N 105
using namespace std;
char s[N][N];
int n,m;
int x,y,ans;
int cnt[N][N];
void mmax(int &x,int v){
x=max(x,v);ans=max(ans,v);
}
int get(int x1,int y1,int x2,int y2){
return cnt[x2][y2]-cnt[x2][y1-1]-cnt[x1-1][y2]+cnt[x1-1][y1-1];
}
int dp[2][N][N][N];
int main(){
scanf("%d%d",&n,&... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=105;
int n,m;
int dp[MAXN][MAXN][MAXN],E[2];
int sumr[MAXN][MAXN],sumc[MAXN][MAXN];
int ori[MAXN][MAXN];
int main()
{
//freopen("robot.in","r",stdin);
//freopen("robot.out","w",stdout);
scanf("%d %d",&n,&m);
for(int i=1;i<=n;... |
Problem: We have a grid with H rows and W columns. The state of the cell at the i-th (1≤i≤H) row and j-th (1≤j≤W) column is represented by a letter a_{ij}, as follows:
* `.` : This cell is empty.
* `o` : This cell contains a robot.
* `E` : This cell contains the exit. `E` occurs exactly once in the whole grid.
Snuk... | #include <bits/stdc++.h>
using namespace std;
#define Int register int
#define MAXN 105
template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<stdio.h>
int main(void)
{
int a,s,d,f,g,i;
f=-1;
g=0;
scanf("%d",&a);
for(i=1;i<=a;i++){
scanf("%d %d",&s,&d);
if(f==d){
if(g>s){
g=s;
}
}
else if(f<d){
f=d;
g=s;
}
}
printf("%d %d\n",g,f);
return 0;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | //Volume0-0095
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
class Player implements Comparable<Player>{
public int a,
v;
Player(int a,int v){
this.a = a;
this.v = v;
}
public int compareTo(Player t){
return this.a - t.a;
}
}
public class Main {
public s... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | d={}
for _ in[0]*int(input()):
a,v=map(int,input().split())
d.setdefault(v,[])
d[v]+=[a]
m=max(d)
print(min(d[m]),m)
|
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | n = int(input())
dic = {}
max_v = 0
for _ in range(n):
a, v = map(int, input().split())
if not v in dic or a < dic[v]:
dic[v] = a
if v > max_v:
max_v = v
print(dic[max_v], max_v)
|
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
private static BufferedReader br = null;
static {
br = new BufferedReader(new InputStreamReader(System.in));
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
using namespace std;
int main() {
int n, id, p, tid = 0, tp = -1;
cin >> n;
while (n--) {
cin >> id >> p;
if (tp == p) {
if (tid > id) {
tid = id;
}
}
else if (tp < p) {
tp = p;
tid = id;
... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.io.*;
import java.util.StringTokenizer;
import java.util.ArrayList;
class List {
ArrayList<Integer> number = new ArrayList<Integer>();
ArrayList<Integer> score = new ArrayList<Integer>();
int max_score,max_n;
List() {
max_score = 0;
max_n = 21;
}
void add(int n,int s) {
number.add(n);
score.... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
public static void main(String[] args){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String tmp = null;
int i = 0;
ArrayList<Integer> ... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
using namespace std;
int main()
{
int n;
int min = 21, max = 0;
int a, v;
cin >> n;
for (int i = 0; i < n; i++){
cin >> a >> v;
if (max < v){
max = v;
min = a;
}
else if (max == v){
if (min > a){
min = a;
}
}
}
cout << min << ' ' <<... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct point{
double x, y;
};
bool cmp_x(const point& p, const point& q){
if(p.x != q.x)return p.x>q.x;
return p.y < q.y;
}
int main(void){
int n;
point a;
vector<point>v;
cin >> n;
while(n--){
cin >> a.y >> a.x;
v... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
int n,a,v,mx,mn,i;
scanf("%d",&n);
mx=-1;
for(i=0;i<n;i++) {
scanf("%d %d",&a,&v);
if(mx<v || (mx==v && mn>a)) {
mx=v; mn=a;
}
}
printf("%d %d\n",mn,mx);
return 0;
}
|
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
using namespace std;
int main()
{
int n;
for(;cin>>n;)
{
int a,v;
cin>>a>>v;
for(int i=1;i<n;i++)
{
int ta,tv;
cin>>ta>>tv;
if(tv>v || (tv==v && a>ta))
{
v=tv;
a=ta;
}
}
cout<<a<<" "<<v<<endl;
}
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <string>
using namespace std;
int main()
{
int n, a, v,maxa,maxv;
cin >> n;
maxv = 0;
for (int i = 0; i < n; i++)
{
cin >> a >> v;
if ((maxv < v) || (a < maxa && v==maxv))
{
maxa = a;
maxv = v;
}
}
cout << maxa << ' ' << maxv << endl;
return 0;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
using namespace std;
int main(){
int n, a, b, m = 0, d;
cin >> n;
for(int i=0;i<n;i++){
cin >> a >> b;
if(m < b){
m = b;
d = a;
}else if(m == b && d > a) d = a;
}
cout << d << ' ' << m << endl;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | d={}
for _ in[0]*int(input()):
a,v=map(int,input().split())
d[v]=min(a,d[v])if v in d else a
m=max(d)
print(d[m],m)
|
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = "";
int[] top = new int[] { 21, -1 };
br.readLine(... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.awt.geom.Point2D;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
public class Main {
Scanner in = new Scanner(System.in);
public static void main(String[] args){
new Main();
}
public Main(){
new AOJ0095();
}
class AOJ0095{
public AOJ0095() {
int n = in.ne... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int num;
cin >> num;
int a,v,maxa=0,maxv=0;
for(int i=0;i<num;i++){
cin >> a >> v;
if(i==0) {
maxa = a; maxv = v;
}
if(maxv < v){
maxv = v; maxa = a;
}
if(maxv == v){
if(maxa>a){
maxv = v; maxa = a;
}
}
}
cout << max... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <bits/stdc++.h>
using namespace std;
struct Human {
int no;
int point;
};
int compareTo(const Human& h1, const Human& h2) {
if(h1.point > h2.point) return(1);
else if(h2.point > h1.point) return(0);
if(h1.no < h2.no) return(1);
else return(0);
}
int main(void) {
int n; scan... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
using namespace std;
int main(){
int n,a,b,ma=1,sum=0;
cin >> n;
for(int i=0;i<n;i++){
cin >> a >> b;
if(b > sum || b == sum && a < ma){
ma = a;
sum = b;
}
}
cout << ma << " " << sum << endl;
return(0);
}
|
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;
int n;
int a[110];
int main(void){
cin >> n;
rep(i,n){
int idx,num;
cin >> idx >> num;
a[idx-1]=num;
}
int ans=max_element(a,a+n)-a;
cout << ans+1 << " " << a[ans] << endl;
return... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | n=int(input())
nmb=21
r_m=0
for i in range(n):
a,v=map(int,input().split())
if r_m<v:
nmb,r_m=a,v
elif r_m==v:
nmb=min(nmb,a)
print(nmb,r_m)
|
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] a=new int[n];
int[] v=new int[n];
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
v[i]=sc.nextInt();
}
for(int i=0;i<n-1;i++){
for(int j=n-1;j>i;j--){
i... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int id = -1;
int max = -1;
for(int i=0; i<n; i++)
{
int a = scanner.nextInt();
int v = scanner.nextInt();
if(v > max)
{
id = a;
... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <vector>
#include <algorithm>
struct P {
int x, y;
bool operator<(const P& o) const {
if (y == o.y) {
return x < o.x;
} else {
return y > o.y;
}
}
};
using namespace std;
int main() {
int n; cin >> n;
vector<P> Ps;
f... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... |
n=int(input())
l=[]
for i in range(n):
x,y=map(int,input().split())
l.append((y,x))
l.sort(key=lambda x:(x[0],x[1]),reverse=True)
maximum=l[0][0]
young=l[0][1]
for i in l:
if maximum==i[0]:
young=i[1]
else:
break
print(young,maximum)
#print(l[0][1],l[0][0]) |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <cstdio>
#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)
using namespace std;
int main(){
int n;
cin >> n;
int s[100] = {0};
rep(i,n){
int a,v;
cin >> a >> v;
s[a] += v;
}
int ans=1;
int sum=0;
reep(i,1,n+... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <cstdio>
using namespace std;
int main()
{
int n;
int a[20], v[20];
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d %d", a + i, v + i);
int ai = 9999, vi = -1;
for (int i = 0; i < n; i++){
if (v[i] > vi){
vi = v[i];
ai = a[i];
}
else if (v[i] == vi){
if (ai > a[i]) ai = a[i]... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <stdio.h>
int main(void)
{
int n,i;
int maxa,maxv;
int a,v;
scanf("%d",&n);
scanf("%d%d",&a,&v);
maxa=a;
maxv=v;
for(i=1;i<n;i++) {
scanf("%d%d",&a,&v);
if(v>maxv || (v==maxv && a<maxa)) {
maxa=a;
maxv=v;
}
}
printf("%d %d\n",maxa,maxv);
... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.Scanner;
public class Main {
void run() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int max = -1;
int maxix = 21;
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
int v = sc.nextInt();
if (v > max) {
max = v;
maxix = a;
} else if (v == max && maxix >... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
new Main();
}
public Main() {
while(sc.hasNext()){
new aoj0095().doIt();
}
}
class aoj0095 {
void doIt() {
int n = sc.nextInt();
int asum[] = new int [n+1];
for(int i = 0;i... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m=0,a,b=100,d;
cin>>n;
while(n--){
cin>>d>>a;
if(m<a){
m=a;
b=d;
}
else if(m==a&&b>d)b=d;
}
cout<<b<<' '<<m<<endl;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n, p, fish;
cin >> n;
int rp = 20;
int max_fish = -100;
for( int i = 0; i < n ; i++ ){
cin >> p >> fish;
if(max_fish < fish || max_fish == fish && rp > p){
rp = p;
max_fish... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0095
"""
import sys
def main(args):
winner = [-1, -1]
n = int(input())
for _ in range(n):
a, v = [int(x) for x in input().strip().split(' ')]
if v > winner[1]:
winner[0] = a
winner[... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int ary[21] = {};
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int a, b;
cin >> a >> b;
ary[a] = b;
}
int *p = max_element(ary + 1, ary + n + 1);
cout << p - ary << ' ' << *p << endl;
return 0;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | x=[map(int,raw_input().split()) for i in range(int(raw_input()))]
a,v=sorted(x,key=lambda x:(-x[1],x[0]))[0]
print a,v |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int n, dummy1, dummy2, max, ans;
int v[1000];
cin >> n;
for(int i = 1; i <= n; i++){
v[i] = 0;
}
for(int i = 1; i <= n; i++){
cin >> dummy1 >> dummy2;
v[dummy1] = dummy2;
}
max = 0;
for(int i = n; i > 0; i--){
if(v[i... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> array = new ... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
using namespace std;
int main(){
int a, v, n, maxv, mina;
cin>>n;
cin>>a>>v;
maxv=v;
mina=a;
for(int i=1;i<n;i++){
cin>>a>>v;
if(maxv<v){
maxv=v;
mina=a;
}else if(maxv==v){
if(mina>a){
mina=a;
}
}
}
cout<<mina<<" "<<maxv<<endl;
return 0;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<stdio.h>
int main(void)
{
int n;
int a[21],v[101];
int i;
int max=0,m;
while(scanf("%d",&n)!=EOF){
for(i=0;i<n;i++){
scanf("%d %d",&a[i],&v[i]);
if(max<v[i]){
max=v[i];
m=a[i];
}
if(max==v[i] && m>a[i]){
m=a[i];
}
}
printf("%d %d\n",m,max);
}
return 0;
} |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | n=input()
L=[0]*n
for i in range(n):
a,v=map(int,raw_input().split())
L[a-1]+=v
print L.index(max(L))+1,max(L) |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<iostream>
#include<map>
#include<algorithm>
using namespace std;
typedef pair < int , int > Pi;
int main(){
int n;
Pi a[20];
cin >> n;
for(int i = 0 ; i < n ; i++ ){
cin >> a[i].second >> a[i].first;
}
int no = -1, big = -1;
for(int i = 0 ; i < n ; i++ ){
if(big < a[i].first) big = a[i].... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ma=-1, mv=0;
for(int i=0;i<n;i++) {
int a = sc.nextInt(), v = sc.nextInt();
if(ma<0 || mv<v || (mv==v && ma>a)) {ma = a; mv = v;}
}
System.out.println(ma + ... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
bool great(const pair<int, int>& l, const pair<int, int>& r) {
if (l.second == r.second) return l.first < r.first;
else return l.second > r.second;
}
int main(){
int n,a,b;
vector<pair<int, int> > v;
cin >> n;
for... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> p;
int main(){
vector<p> v;
int n,data,num;
cin >> n;
for(int i = 0 ; i < n ; i++){
cin >> num >> data;
v.push_back(p(-data,num));
}
stable_sort(v.begin(),v.end());
cout ... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.Scanner;
public class Main {
public static void main(String[] arg) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int top = -1;
int max = -1;
for (int i = 0; i < n; i++) {
int a = in.nextInt();
int v = in.nextInt();
if (v > max || v == max && top > a) {
top = a;
... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <string>
using namespace std;
int main(){
int n, a, v, maxa, maxv;
while (cin >> n) {
int maxa = 21, maxv = 0;
for (int i = 0; i < n; i++) {
cin >> a >> v;
if (v > maxv) {
maxv = v;
maxa = a;
}
else if(v == maxv && maxa > a){
maxa = a;
}
}
cout << maxa ... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <bits/stdc++.h>
using namespace std;
const int N = 20;
int main() {
int n, m = 0;
int a[N + 1] = { 0 };
int x, y;
cin >> n;
for(int i = 0;i < n;++i) {
cin >> x >> y;
a[x] = y;
m = y > m ? y : m;
}
for(int i = 1;i <= N;++i) {
if(a[i] == m) {
cout << i << " " << a[i] << endl;
break;
}
... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main(){
int n;
cin >> n;
pair <int,int> data[20];
for(int i=0;i<n;i++) {
cin >> data[i].second >> data[i].first;
data[i].second *= -1;
}
sort(data,data + n);
cout << -data[n-1].second << " " << ... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | #include<cstdio>
using namespace std;
int main(void)
{
int n,a,b,i,max,x;
scanf("%d",&n);
max=0;
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);
if(max<=b){
if(max<b){
x=a;
max=b;
}
else if(x>a)x=a;
}
}
printf("%d %d\n",x,max);
... |
Problem: A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the l... | import java.util.Scanner;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
TreeMap<Integer,Integer> treeMap = new TreeMap<Integer,Integer>();
Scanner scan = new Scanner(System.in);
int win = 0;
while(scan.hasNext()) {
int num = scan.nextInt();
for(int i = 1;i < num ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.