Submission #821141

#TimeUsernameProblemLanguageResultExecution timeMemory
821141alexander707070Marshmallow Molecules (CCO19_day2problem2)C++14
5 / 25
4045 ms85512 KiB
#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]; int main(){ cin>>n>>m; for(int i=1;i<=m;i++){ cin>>a[i]>>b[i]; between[a[i]][b[i]]++; lines[a[i]].push_back(b[i]); } for(int i=1;i<=n;i++){ sort(lines[i].begin(),lines[i].end()); for(int f=0;f<lines[i].size();f++){ for(int k=f+1;k<lines[i].size();k++){ if(!between[lines[i][f]][lines[i][k]]){ ans++; between[lines[i][f]][lines[i][k]]=true; lines[lines[i][f]].push_back(lines[i][k]); } } } } cout<<ans+m<<"\n"; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:14:27: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
   14 |         between[a[i]][b[i]]++;
      |         ~~~~~~~~~~~~~~~~~~^
Main.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(int f=0;f<lines[i].size();f++){
      |                     ~^~~~~~~~~~~~~~~~
Main.cpp:21:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(int k=f+1;k<lines[i].size();k++){
      |                           ~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...