- 博客(44)
- 收藏
- 关注
原创 UVA 11100(p81)----The Trip, 2007
#include#define debuusing namespace std;const int maxn=1e4+50;int ans,n;int a[maxn];map m;void solve(){ sort(a,a+n); printf("%d\n",ans); for(int i=0; i<ans; i++) { prin
2016-03-26 20:24:40 635
原创 UVA 11627(p80)----Slalom
#include#define debuusing namespace std;const int maxn=1e6+50;int maxx,w,vh,n,s,ans,tmp;int x[maxn],y[maxn],ski[maxn];int check(int speed){ double l=(double)x[0],r=(double)(x[0]+w); for
2016-03-26 20:10:41 588
原创 UVA 1252(p287)----Twenty Questions
#include#define debuusing namespace std;const int maxn=150;const int maxm=(1<<11)+50;int n,m;char item[maxn][15];int d[maxm][maxm];int cnt[maxm][maxm];int solve(int s,int a){ if(d[s][a]!
2016-03-26 20:03:38 516
原创 UVA 10934(p292)----Dropping water balloons
#include#include#include#include#define debuusing namespace std;typedef unsigned long long ULL;int k;ULL n;ULL f[150][100];void prepare(){ memset(f,0,sizeof(f)); for(int i=1; i<=63;
2016-03-26 19:56:22 500
原创 UVA 10384(p219)----The Wall Pusher
#include#define debuusing namespace std;const int dx[]= {0,-1,0,1};const int dy[]= {-1,0,1,0};const int d[]= {1,2,4,8};const char dir[]= {"WNES"};int stx,sty;int g[10][20];int v[10][20];char
2016-03-26 19:48:00 629
原创 UVA 11214(p217)----Guarding the Chessboard
#include#include#include#define debuusing namespace std;const int maxn=50;int v[5][100];int g[15][15];int n,m,cas=0;int check(){ for(int i=0; i<n; i++) for(int j=0; j<m; j++)
2016-03-26 19:40:44 656
原创 UVA 1343(p210)----The Rotation Game
#include#define debuusing namespace std;int cmd[8][7]={ {0,2,6,11,15,20,22}, {1,3,8,12,17,21,23}, {10,9,8,7,6,5,4}, {19,18,17,16,15,14,13},};const int opp[8]= {5,4,7,6,1,0,3,2};
2016-03-26 19:35:16 523
原创 UVA 1374(p211)----Power Calculus
#include#include#include#define debuusing namespace std;const int maxn=1e4+50;int n;int a[maxn];int solve(int dep,int maxd,int now){ if(dep>maxd) return 0; if(now==n) { pr
2016-03-26 19:31:20 481
原创 UVA 307(p218)----Sticks
#include#include#include#include#define debuusing namespace std;const int maxn=1e7;int n,l,sum;int a[maxn];int v[maxn];int cmp(int a,int b){ return a>b;}int dfs(int len,int num,int po
2016-03-26 19:19:43 408
原创 UVA 11039(p78)----Building designing
#include#define debuusing namespace std;const int maxn=5*1e5+50;int a[maxn];int b[maxn];int n,num1,num2;void solve(){ int ans=0,pos,flag,now; sort(a,a+num1); sort(b,b+num2); if
2016-03-23 22:21:16 387
原创 UVA 10970(p79)----Big Chocolate
#includeusing namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { printf("%d\n",n*m-1); } return 0;}题目地址:https://uva.onlinejudge.org/index.php?optio
2016-03-23 22:17:53 229
原创 UVA 10382(p79)----Watering Grass
#include#define debuusing namespace std;const int maxn=1e4+50;struct point{ double l,r; bool operator < (const point& rhs) const { if(rhs.l==l) return rhs.r>r; else re
2016-03-23 22:13:38 319
原创 LA 3029(p50)----City Game
#include#define debuusing namespace std;const int maxn=1e3+50;int n,m;int g[maxn][maxn];int up[maxn][maxn];int lt[maxn][maxn];int rt[maxn][maxn];void init(){ memset(g,0,sizeof(g)); m
2016-03-23 22:00:41 684
原创 LA 3695(p52)----Distant Galaxy
#include#define debuusing namespace std;const int maxn=100+50;struct point{ int x,y; bool operator < (const point& rhs) const { if(rhs.y==y) return rhs.x>x; else retur
2016-03-23 21:51:23 315
原创 LA 4254(p80)----Processor
#include#define debuusing namespace std;const int INF=1e7;const int maxn=1e4+50;struct point{ int l,r,w; bool operator < (const point& rhs) const { return r>rhs.r; }};i
2016-03-23 21:42:48 340
原创 UVA 10870(p155)----Recurrences
#include#define debuusing namespace std;typedef long long LL;const int maxn=25;struct Matrix{ LL mat[maxn][maxn];};int d;LL m;LL ans,n;Matrix a,c;LL f[maxn];Matrix operator * (Matrix
2016-03-21 16:03:30 407
原创 UVA 10917(p330)----Walk through the Forest
#include#define debuusing namespace std;const int INF=1e10;const int maxn=1e3+50;struct Edge{ int from,to,dist; Edge(int a=0,int b=0,int c=0):from(a),to(b),dist(c) {}};struct HeapNode
2016-03-10 22:09:24 281
原创 LA 2191(p247)----Potentiometers
#include#define debuusing namespace std;typedef long long LL;const int maxn=1e6+50;int n,cas=0;char cmd[4];LL c[maxn];LL a[maxn];inline int lowbit(int x){ return x&(-x);}void add(int x
2016-03-10 22:02:37 644
原创 UVA 11136(p245)----Hoax or what
#include#define debuusing namespace std;int n;multiset s;int main(){#ifdef debug freopen("in.in","r",stdin);#endif // debug while(scanf("%d",&n)==1&&n) { s.clear();
2016-03-10 21:57:25 318
原创 UVA 10905(p79)----Children's Game
#include#define debuusing namespace std;int n;string st[55];int cmp(string st1,string st2){ return st1+st2>st2+st1;}int main(){#ifdef debug freopen("in.in","r",stdin);#endif // debg
2016-03-10 21:52:33 348
原创 UVA 10125(p89)----Sumsets
#include#define debuusing namespace std;typedef long long LL;const int maxn=1e3+50;const LL INF=1e10;int n;set s;LL a[maxn];map > num;int check(LL x,LL y){ LL tmp=x-y; /*if(s.count(
2016-03-10 21:45:28 351
原创 UVA 11134(p237)----Fabled Rooks
#include#define debuusing namespace std;const int maxn=5*1e3+50;struct point{ int l,r,id;};int n,v[maxn];point a[maxn],b[maxn];int ansx[maxn],ansy[maxn];int cmp(point a,point b){ i
2016-03-10 21:30:13 267
原创 UVA 1471(p242)----Defense Lines
#include#define debuusing namespace std;const int maxn=2*1e5+50;const int INF=1e9+50;struct point{ int w,g; point(int a=0,int b=0):w(a),g(b) {} bool operator < (const point& rhs) con
2016-03-10 21:19:09 446
原创 UVA 11374(p329)----Airport Express
#include#define debuusing namespace std;const int INF=999999;const int maxn=1e4+50;struct Edge{ int from,to,dist; Edge(int a=0,int b=0,int c=0):from(a),to(b),dist(c) {}};struct HeapNod
2016-03-07 11:38:44 359
原创 UVA 11090(p333)----Going in Cycle!!
#include#define debuusing namespace std;const int maxn=100;struct Edge{ int from,to; double dist;};struct BellmanFord{ int n,m; vector edges; vector G[maxn]; bool inq[m
2016-03-06 22:10:17 311
原创 UVA 11636(p78)----Hello World!
#includeusing namespace std;int main(){ int n,cas=0; while(scanf("%d",&n)!=EOF) { if(n<0) break; int step=0,now=1; for(int i=1;i<=20;i++) { i
2016-03-06 17:41:38 313
原创 LA 3211(p325)----Now or later
#include#define debuusing namespace std;const int maxn=2*1e3+50;struct TwoSAT{ int n; vector G[maxn*2]; bool mark[maxn*2]; int S[maxn*2],c; bool dfs(int x) { if(ma
2016-03-06 17:14:06 331
原创 LA 4287(p322)----Proving Equivalences
#include#define debuusing namespace std;const int maxn=1e5+50;int s[maxn];int v[maxn];int dfn[maxn];int scc[maxn];int low[maxn];int sum1,sum2;int n,m,all,top,num;int din[maxn],dout[maxn];v
2016-03-06 15:03:53 265
原创 LA 3905(p45)----Meteor
#include#define debuusing namespace std;typedef double DB;struct point{ int flag; DB w; point(DB a=0.0,int b=0):w(a),flag(b) {}};int n;DB w,h;vector all;void make(DB px,DB py,DB
2016-03-05 21:51:00 370
原创 LA 4255(p309)----Guess
#include#define debuusing namespace std;const int INF=99999;struct point{ int x,y; point(int a=0,int b=0):x(a),y(b) {}};const int maxn=15;char st[60];stack s;int d[maxn];int n,sum[m
2016-03-05 19:44:09 301
原创 LA 4329(p197)----Ping pong
#include#define debuusing namespace std;typedef long long LL;const int maxn=2*1e4+50;const int maxnn=1e5+50;int a[maxn];int n,l[maxn],maxx;int c[maxnn],r[maxn];inline int lowbit(int x){
2016-03-04 17:14:49 238
原创 LA 3027(p192)----Corporative Network
#include#define debuusing namespace std;const int maxn=2*1e4+50;int fa[maxn],ans[maxn],n;int Find(int x){ if(x!=fa[x]) { int root=Find(fa[x]); ans[x]+=ans[fa[x]];
2016-03-04 14:13:44 277
原创 UVA 11995(p186)----I Can Guess the Data Structure!
#include#define debuusing namespace std;int n,flag[3];stack s;queue q;priority_queue,less >pq;void enter(int x){ s.push(x); q.push(x); pq.push(x);}int output(int i){ int tmp
2016-03-02 21:42:02 279
原创 LA 3644(p191)----X-Plosives
#include#define debuusing namespace std;const int maxn=1e5+50;int ans;int fa[maxn],Rank[maxn];int Find(int root){ int k,j,x; x=root; while(x!=fa[x]) x=fa[x]; k=root; while(k
2016-03-02 17:16:43 323
原创 LA 3135(p188)----Argus
#include#define debuusing namespace std;const int maxn=1010;char st[10];struct point{ int id,t; point(int a=0,int b=0):id(a),t(b){}};point b[maxn];vector a;int cmp(point a,point b){
2016-03-02 17:13:58 403
原创 UVA 11991(p187)----Easy Problem from Rujia Liu?
#include#define debuusing namespace std;int n,m;map > a;int main(){#ifdef debug freopen("in.in","r",stdin);#endif // debug while(scanf("%d%d",&n,&m)!=EOF) { for(int i=0; i<
2016-03-02 17:09:13 326
原创 LA 2678(p48)----Subsequence
#include#define debuusing namespace std;const int INF=9999999;const int maxn=1e5+50;int n,s;int a[maxn],sum[maxn];void solve(){ int ans=INF; for(int j=0; j<n; j++) { int i=
2016-03-01 17:19:30 259
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人