原题链接: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; }
时间: 2024-12-20 16:34:27