답안 #167381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167381 2019-12-07T19:43:24 Z ahmet Izlet (COI19_izlet) C++14
25 / 100
818 ms 52984 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=3005;
int ss,n,c[mx][mx];
vector <pair <int,int> > vans;
int ans[mx];
int main(){
	/*freopen(".in", "r", stdin);
	freopen(".out", "w", stdout); 
    */ios_base::sync_with_stdio(false);cin.tie(NULL);
	cin >> ss >> n;
	ref(i,1,n){
		ans[i]=-1;
			ref(j,1,n){
			cin >> c[i][j];
		}
	}
	ans[1]=1;
	set <int> s;
	//*--a.end() *a.rbegin()
	int sn=1;
	for(int i=2;i<=n;++i){
		if(c[i][i-1]==1){
			ans[i]=ans[i-1];
		}
		else if(c[1][i-1]!=c[1][i]){
			ans[i]=sn+1;
			++sn;
		}
		else if(i>2){
			int flag=0;
			for(int j=i-2;j>0;--j){
				//cout << "MAK";
				if(c[j][i-1]==c[j][i]){
					ans[i]=ans[j];
					break;
				}
			}
		}
		s.insert(ans[i]);
	}

	for(int i=1;i<=n;++i)
		cout << ans[i] << " ";

	cout << endl;
	
	for(int i=1;i<n;++i)
		cout << i << " "<< i+1 << endl;

}

Compilation message

izlet.cpp: In function 'int main()':
izlet.cpp:39:8: warning: unused variable 'flag' [-Wunused-variable]
    int flag=0;
        ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 590 ms 44792 KB Output is correct
2 Correct 664 ms 43956 KB Output is correct
3 Correct 818 ms 50312 KB Output is correct
4 Correct 777 ms 52984 KB Output is correct
5 Correct 583 ms 43984 KB Output is correct
6 Correct 721 ms 49872 KB Output is correct
7 Correct 533 ms 38008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -