# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1048388 | 2024-08-08T07:14:53 Z | 김은성(#11035) | Make them Meet (EGOI24_makethemmeet) | C++17 | 3 ms | 860 KB |
#include <bits/stdc++.h> using namespace std; vector<int> graph[109]; vector<vector<int> > moves; int n, color[109]; void make_move(){ vector<int> temp; for(int i=0; i<n; i++) temp.push_back(color[i]); moves.push_back(temp); } void answer(){ printf("%d\n", moves.size()); for(vector<int> u: moves){ for(int v: u) printf("%d ", v); printf("\n"); } } int main(){ int m, i, j, k, u, v; scanf("%d %d", &n, &m); for(i=1; i<=m; i++){ scanf("%d %d", &u, &v); graph[u].push_back(v); graph[v].push_back(u); } for(i=1; i<n; i++){ for(k=0; k<n; k++){ color[k]= k+1; } bool ch[109] = {0, }; vector<int> vec; for(j=0; j<n; j++){ if(!ch[j]){ for(int j2 = j; !ch[j2]; j2 = (j2 + i) % n){ //printf("j2=%d\n", j2); vec.push_back(j2); ch[j2]= 1; } } } for(k=0; k<n; k++){ color[k]= k+1; } for(j=0; j<vec.size()-1; j+=2){ color[vec[j]] = color[(vec[j] + i) % n] = vec[j]+1; } make_move(); make_move(); for(k=0; k<n; k++){ color[k]= k+1; } for(j=1; j<vec.size()-1; j+=2){ color[vec[j]] = color[(vec[j] + i) % n] = vec[j]+1; } make_move(); make_move(); for(k=0; k<n; k++){ color[k]= k+1; } for(j=vec.size()-1; j<=vec.size()-1; j+=2){ color[vec[j]] = color[(vec[j] + i) % n] = vec[j]+1; } make_move(); make_move(); } answer(); return 0; for(i=1; i<n; i++){ for(j=i+1; j<n; j++){ for(k=0; k<n; k++){ if(k==0 || k==i) color[k] = 2; else color[k]= 1; } make_move(); for(k=0; k<n; k++){ if(k==0 || k==j) color[k] = 2; else color[k]= 1; } make_move(); for(k=0; k<n; k++){ if(k==0 || k==j) color[k] = 2; else color[k]= 1; } make_move(); for(k=0; k<n; k++){ if(k==0 || k==i) color[k] = 2; else color[k]= 1; } make_move(); } } answer(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | If people start at 1 and 2, then they can avoid each other |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | If people start at 0 and 2, then they can avoid each other |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | If people start at 1 and 2, then they can avoid each other |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | If people start at 1 and 2, then they can avoid each other |
3 | Halted | 0 ms | 0 KB | - |