Submission #707406

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7074062023-03-09 01:35:15EthanKim8683Bitaro’s Party (JOI18_bitaro)C++17
7 / 100
2052 ms346500 KiB
#include<bits/stdc++.h>
using namespace std;
using I=int;
const I N=100000;
const I MIN=-1e9;
vector<I>adjs[N];
set<I>viss;
vector<pair<I,I>>pres[N];
vector<pair<I,I>>tops[N];
set<I>curs;
I dp[N];
I main(){
cin.tie(0)->sync_with_stdio(0);
I n,m,q;cin>>n>>m>>q;
for(I i=0;i<m;i++){
I s,e;cin>>s>>e,s--,e--;
adjs[s].push_back(e);
}
I siz=sqrt(n/log2(n))*2;
for(I i=0;i<n;i++){
pres[i].push_back({0,i});
sort(pres[i].begin(),pres[i].end());
viss.clear();
for(I j=0;tops[i].size()<siz&&j<pres[i].size();j++){
auto[dis,k]=pres[i][j];
if(viss.count(k))continue;
viss.insert(k),tops[i].push_back({dis,k});
}
pres[i].clear();
for(auto j:adjs[i])for(auto[dis,k]:tops[i])pres[j].push_back({dis-1,k});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bitaro.cpp: In function 'I main()':
bitaro.cpp:24:29: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'I' {aka 'int'} [-Wsign-compare]
   24 |     for(I j=0;tops[i].size()<siz&&j<pres[i].size();j++){
      |               ~~~~~~~~~~~~~~^~~~
bitaro.cpp:24:36: warning: comparison of integer expressions of different signedness: 'I' {aka 'int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(I j=0;tops[i].size()<siz&&j<pres[i].size();j++){
      |                                   ~^~~~~~~~~~~~~~~
bitaro.cpp:39:19: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'I' {aka 'int'} [-Wsign-compare]
   39 |     if(curs.size()<=siz){printf("-1\n");continue;}
      |        ~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...