| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1347906 | titlewave | Finding Routers (IOI20_routers) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "route.h"
using namespace std;
vector<pair<int,int>> route(int N,vector<int> W)
{
int n=N;
vector<pair<int,int>> ans;
int m=W.size();
int now=1,rem=1;
for(int i=1;i<=m;i++){
if(m-i+1<=n-now){
for(int j=i;j<=m;j++) ans.push_back({now,now+j-i+1});
break;
}
if(rem>=now) rem=1,now++;
ans.push_back({rem,now});
rem++;
}
return ans;
}
