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>
#define MAXN 100007
using namespace std;
int n,m,a[MAXN],b[MAXN],ans;
bool between[5007][5007];
vector<int> lines[MAXN];
bitset<5007> bits[5007],curr;
int main(){
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>a[i]>>b[i];
bits[b[i]][a[i]]=1;
}
for(int i=1;i<=n;i++){
for(int f=1;f<=i-1;f++){
curr=bits[i]&bits[f];
if(curr.count()!=0 and bits[i][f]==0){
bits[i][f]=1; ans++;
}
}
}
cout<<ans+m<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |