# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236338 | kshitij_sodani | Airline Route Map (JOI18_airline) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#include "Alicelib.h"
map<int,int> x;
/*void InitG(int ac,int bc){
cout<<ac<<" "<<bc<<endl;
}
void MakeG(int ac,int bc,int cc){
cout<<bc<<" "<<cc<<endl;
}*/
void Alice(int n, int m, int aa[], int bb[]){
for(int i=0;i<1024;i++){
x[i]=i;
}
x[511]=1003;
x[767]=1005;
x[895]=1006;
x[959]=1011;
x[991]=1013;
vector<pair<int,int>> ans;
for(int i=0;i<m;i++){
ans.pb({aa[i],bb[i]});
}
for(int ii=0;ii<n;ii++){
int i=x[ii];
for(int j=0;j<10;j++){
if(i&(1<<j)){
ans.pb({n+2+j,ii});
}
}
}
for(int i=0;i<n;i++){
ans.pb({n+1,i});
}
for(int j=0;j<n+12;j++){
if(j==n or j==n+1){
continue;
}
ans.pb({n,j});
}
for(int i=n+2;i<n+11;i++){
ans.pb({i,i+1});
}
InitG(n+12,ans.size());
int kk=0;
for(auto j:ans){
MakeG(kk,j.a,j.b);
kk+=1;
}
}
/*int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no,mo;
cin>>no>>mo;
int cc[mo];
int dd[mo];
for(int i=0;i<mo;i++){
cin>>cc[i]>>dd[i];
}
Alice(no,mo,cc,dd);
return 0;
}*/
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#include "Alicelib.h"
map<int,int> x;
/*void InitG(int ac,int bc){
cout<<ac<<" "<<bc<<endl;
}
void MakeG(int ac,int bc,int cc){
cout<<bc<<" "<<cc<<endl;
}*/
void Alice(int n, int m, int aa[], int bb[]){
for(int i=0;i<1024;i++){
x[i]=i;
}
x[511]=1003;
x[767]=1005;
x[895]=1006;
x[959]=1011;
x[991]=1013;
vector<pair<int,int>> ans;
for(int i=0;i<m;i++){
ans.pb({aa[i],bb[i]});
}
for(int ii=0;ii<n;ii++){
int i=x[ii];
for(int j=0;j<10;j++){
if(i&(1<<j)){
ans.pb({n+2+j,ii});
}
}
}
for(int i=0;i<n;i++){
ans.pb({n+1,i});
}
for(int j=0;j<n+12;j++){
if(j==n or j==n+1){
continue;
}
ans.pb({n,j});
}
for(int i=n+2;i<n+11;i++){
ans.pb({i,i+1});
}
InitG(n+12,ans.size());
int kk=0;
for(auto j:ans){
MakeG(kk,j.a,j.b);
kk+=1;
}
}
/*int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no,mo;
cin>>no>>mo;
int cc[mo];
int dd[mo];
for(int i=0;i<mo;i++){
cin>>cc[i]>>dd[i];
}
Alice(no,mo,cc,dd);
return 0;
}*/