QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#769798 | #9446. Construction of Town | woodie_0064# | TL | 0ms | 0kb | C++20 | 693b | 2024-11-21 19:25:52 | 2024-11-21 19:25:53 |
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
const int mod = 998244353;
typedef long long ll;
void work(){
int n,m;cin >> n >> m;
vector <pair <int,int>> ans;
for(int i = 0;i < m;i++) {
int x;cin >> x;
}
m -= (n - 1);
for(int i = 1;i < n;i++) ans.push_back({0,i});
for(int i = 1;i < n;i++) {
for(int j = i + 1;j < n;j++) {
if(!m) break;
m -= 1;
ans.push_back({i,j});
}
if(!m) break;
}
for(auto &[x,y] : ans) cout << x+ 1 << ' ' << y + 1 << '\n';
}
int main(){
freopen("test.txt", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
int T = 1;
// cin >> T;
while(T--){
work();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
3 2 4 5