码迷,mamicode.com
首页 > Web开发 > 详细

Codeforces 583 DIV2 Asphalting Roads 模拟

时间:2015-10-04 20:47:58      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:

原题链接:http://codeforces.com/problemset/problem/583/A

题意:

很迷很迷,表示没看懂。。但是你看样例就秒懂了

题解:

照着样例模拟就好

代码:

#include<iostream>
#include<cstring>
#include<algorithm>
#define MAX_N 55
using namespace std;

bool h[MAX_N],v[MAX_N];
int n;

int main(){
    cin>>n;
    for(int i=0;i<n*n;i++) {
        int a, b;
        cin >> a >> b;
        if (h[a] || v[b])continue;
        h[a] = v[b] = 1;
        cout << i+1 << " ";
    }
    cout<<endl;
    return 0;
}

 

Codeforces 583 DIV2 Asphalting Roads 模拟

标签:

原文地址:http://www.cnblogs.com/HarryGuo2012/p/4854881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!