Submission #821061

#TimeUsernameProblemLanguageResultExecution timeMemory
821061PVM_pvmMarshmallow Molecules (CCO19_day2problem2)C++17
10 / 25
1520 ms3412 KiB
#include<bits/stdc++.h> using namespace std; #define MAXN 5007 bitset<MAXN> gr[MAXN]; int n,m; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n>>m; for (int q=0;q<m;q++) { int a,b; cin>>a>>b; gr[a][b]=1; } long long ans=0; for (int q=1;q<=n;q++) { ans+=gr[q].count(); while(true) { int pos=gr[q]._Find_first(); if (pos==gr[q].size()) break; gr[q][pos]=0; gr[pos]=gr[pos]|gr[q]; } } cout<<ans<<"\n"; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if (pos==gr[q].size()) break;
      |                 ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...