답안 #821171

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
821171 2023-08-11T07:54:49 Z alexander707070 Marshmallow Molecules (CCO19_day2problem2) C++14
0 / 25
5 ms 5216 KB
#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){
                bits[i][f]=1; ans++;
            }
        }
    }

    cout<<ans+m<<"\n";

    return 0;
}


 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Incorrect 4 ms 2644 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Incorrect 4 ms 2644 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 5216 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Incorrect 4 ms 2644 KB Output isn't correct
4 Halted 0 ms 0 KB -