제출 #1341800

#제출 시각아이디문제언어결과실행 시간메모리
1341800antarbanik세계 지도 (IOI25_worldmap)C++20
0 / 100
1 ms836 KiB
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second



vector<int>G[42];



void f(vector<vector<int>> &ans, int cur, int mx, int curRow){
    if(cur >= mx) return;

    if(curRow % 2 != 0){
        curRow++;
    }


    vector<int> temp;
    for(auto e : G[cur]) temp.pb(e);
    int tempInd = 0;

    for(int i = 0;i<ans.size();++i){
        if(i % 2 == 0) ans[curRow][i] = cur;
        else{
            ans[curRow][i] = temp[tempInd];
            tempInd++;
            if(tempInd == temp.size()) break;
        }
    }

    f(ans, cur + 1, mx, curRow + 1);

}



vector<vector<int>> create_map(int N, int M, vector<int> A, vector<int> B){

    for(int i = 0;i<M;++i){
        G[A[i]].pb(B[i]);
        G[B[i]].pb(A[i]);
    }


    vector<vector<int>> ans(200, vector<int> (200, 0));
    f(ans, 1, N+1, 0);
    for(int i = 0;i<ans.size();++i){
        for(int j = 0;j<ans.size();++j){
            if(ans[i][j] == 0) ans[i][j] = 1;
        }
    }



    return ans;
}



// int main(){
//     vector<vector<int>> ans = create_map(5, 7, {1, 1, 1, 1, 2, 2, 3}, {2, 3, 4, 5, 3, 4, 5});

//     for(int i = 0;i<ans.size();++i){
//         for(int j = 0;j<ans.size();++j){
//             cout<<ans[i][j]<<" ";
//         }
//         cout<<endl;
//     }

// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...