Submission #28592

#TimeUsernameProblemLanguageResultExecution timeMemory
28592맞왜틀 맞왜틀 신나는노래~ 헤이! 나도한번 불러보자 (#68)Alternative Mart (FXCUP2_mart)C++11
Compilation error
0 ms0 KiB
#include <cstdio> #include <map> #include <queue> #include <set> std::vector<std::pair<int,int>> G[50010]; std::vector<std::pair<int,int>> CK[50010]; struct node{ int v, id, from; }; bool operator<(node n1, node n2){ return std::make_pair(-n1.v,n1.from) < std::make_pair(-n2.v,n2.from); } int main(){ int N,M,K,Q; scanf("%d%d%d%d",&N,&M,&K,&Q); std::priority_queue<node> q; for(int i =0 ; i< K;i++){ int v; scanf("%d",&v); q.push({0,v,v}); } for(int i = 0; i < M ; i++){ int A,B,C; scanf("%d%d%d",&A,&B,&C); G[A].push_back({B,C}); G[B].push_back({A,C}); } while(q.size() != 0){ auto t = q.top(); q.pop(); if(CK[t.id].size() > 10) continue; bool flag = false; for(auto i : CK[t.id]){ if(i.second == t.from) { flag = true; break; } } if(flag) continue; CK[t.id].push_back({t.v,t.from}); for(auto i : G[t.id]){ q.push({t.v+i.second,i.first,t.from}); } } for(int i =0 ; i < Q;i ++){ int S, X; scanf("%d%d",&S,&X); std::set<int> PC; for(int j =0; j < X; j++){ int v; scanf("%d",&v); PC.insert(v); } std::sort(CK[S].begin(),CK[S].end()); for(auto j : CK[S]){ if(!PC.count(j.second)){ printf("%d %d\n",j.second,j.first); break; } } } }

Compilation message (stderr)

mart.cpp: In function 'int main()':
mart.cpp:55:9: error: 'sort' is not a member of 'std'
         std::sort(CK[S].begin(),CK[S].end());
         ^
mart.cpp:15:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d%d",&N,&M,&K,&Q);
                                  ^
mart.cpp:19:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&v);
                       ^
mart.cpp:24:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&A,&B,&C);
                                 ^
mart.cpp:48:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&S,&X);
                            ^
mart.cpp:52:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&v);
                           ^