2015-03-08 19:03:57
思路:这场打得不好... 怒降滚粗...
T1紧张+粗心傻逼地 wa 了两发...
T2知道怎么做... 但是wa到死 TAT,最后拿自己的错误点hack了一发,骗了点分...
T3、T4没看。
赛后补了T2、T3、T4。
T3,公式证明半天... 一个细节没考虑... wa好多发QAQ
T4,一道挖掘隐藏条件的DP... 很水... 竟然放在最后,坑死了。
T1:三关键词排序...
1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <vector> 6 #include <map> 7 #include <set> 8 #include <stack> 9 #include <queue> 10 #include <string> 11 #include <iostream> 12 #include <algorithm> 13 using namespace std; 14 15 #define MEM(a,b) memset(a,b,sizeof(a)) 16 #define REP(i,n) for(int i=1;i<=(n);++i) 17 #define REV(i,n) for(int i=(n);i>=1;--i) 18 #define FOR(i,a,b) for(int i=(a);i<=(b);++i) 19 #define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 20 #define getmid(l,r) ((l) + ((r) - (l)) / 2) 21 #define MP(a,b) make_pair(a,b) 22 23 typedef long long ll; 24 typedef pair<int,int> pii; 25 const int INF = (1 << 30) - 1; 26 27 int n; 28 struct node{ 29 int a,b,id; 30 }nd[105]; 31 32 bool cmp(node a,node b){ 33 if(a.a - a.b == b.a - b.b){ 34 if(a.b == b.b) return a.id < b.id; 35 return a.b < b.b; 36 } 37 return (a.a - a.b) > (b.a - b.b); 38 } 39 40 int main(){ 41 while(scanf("%d",&n) != EOF){ 42 REP(i,n) scanf("%d%d",&nd[i].a,&nd[i].b),nd[i].id = i; 43 sort(nd + 1,nd + n + 1,cmp); 44 REP(i,n){ 45 printf("%d%c",nd[i].id - 1,i == n ? '\n' : ' '); 46 } 47 } 48 return 0; 49 }