Cards with Numbers
2013-10-14 21:44
225 查看
http://codeforces.com/contest/254/problem/A
// File Name: cf_a.c // Author: bo_jwolf // Created Time: 2013年10月14日 星期一 21:22:17 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<time.h> #include<math.h> #include<iostream> #include<algorithm> using namespace std; const int maxn = 1000005; struct node{ int x, y; } num[ maxn ]; bool cmp( const node a, const node b ){ return a.x > b.x; } int main(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int n; scanf( "%d", &n ); for( int i = 1; i <= 2 * n; ++i ){ scanf( "%d", &num[ i ].x ); num[ i ].y = i; } sort( num + 1, num + 2 * n + 1 , cmp ); // for( int i = 1; i <= 2 * n; ++i ) // cout << num[ i ].x << endl; for( int i = 1; i <= 2 * n ; i += 2 ){ if( num[ i ].x != num[ i + 1 ].x ){ puts( "-1" ); return 0; } } for( int i = 1; i <= 2 * n; i += 2 ){ printf( "%d %d\n", num[ i + 1 ].y, num[ i].y ); } return 0 ; }
相关文章推荐
- CodeForces 1209 A. Cards with Numbers
- CodeForces - 254A - Cards with Numbers
- A. Cards with Numbers
- Codeforces Round #155 (Div. 2) A. Cards with Numbers
- [Codeforces Round #155 (Div. 2)]A. Cards with Numbers
- Cards with Numbers
- 00-自测4. Have Fun with Numbers (20)
- PAT 甲级 1023. Have Fun with Numbers
- 1023. Have Fun with Numbers (20)
- 1023. Have Fun with Numbers (20) @ PAT (Advanced Level) Practise
- Leetcode #357 Count Numbers with Unique Digits
- 【357】Count Numbers with Unique Digits
- Can't zip RDDs with unequal numbers of partitions: List(1, 2)
- 1023. Have Fun with Numbers (20)
- PAT 1023. Have Fun with Numbers (20)
- 00-自测4. Have Fun with Numbers (20)
- leecode_357 Count Numbers with Unique Digits
- Count Numbers with Unique Digits
- 自测-4 Have Fun with Numbers
- 00-自测4. Have Fun with Numbers (20)