제출 #433804

#제출 시각아이디문제언어결과실행 시간메모리
433804JeanBombeur다리 (APIO19_bridges)C++17
13 / 100
3090 ms7056 KiB
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> using namespace std; // <|°_°|> const int MAX_NOEUDS = (50 * 1000); vector <int> Voisins[MAX_NOEUDS]; pair <int, int> Aretes[4 * MAX_NOEUDS]; bool Vu[MAX_NOEUDS]; int nbNoeuds, nbAretes, nbRequetes; void Clear() { fill_n(Vu, nbNoeuds, false); return; } int Count(int noeud, int val) { int sum = 1; Vu[noeud] = true; for (int id : Voisins[noeud]) { if (!Vu[Aretes[id].first] && Aretes[id].second >= val) sum += Count(Aretes[id].first, val); } return sum; } void Read() { scanf("%d %d", &nbNoeuds, &nbAretes); for (int i = 0; i < nbAretes; i ++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); Voisins[-- a].push_back(2 * i); Voisins[-- b].push_back(2 * i + 1); Aretes[2 * i] = {b, c}; Aretes[2 * i + 1] = {a, c}; } return; } void Solve() { scanf("%d", &nbRequetes); for (int i = 0; i < nbRequetes; i ++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); b --; if (a == 1) Aretes[2 * b].second = Aretes[2 * b + 1].second = c; else { printf("%d\n", Count(b, c)); Clear(); } } return; } int main() { Read(); Solve(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bridges.cpp: In function 'void Read()':
bridges.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |  scanf("%d %d", &nbNoeuds, &nbAretes);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bridges.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |   scanf("%d %d %d", &a, &b, &c);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bridges.cpp: In function 'void Solve()':
bridges.cpp:50:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |  scanf("%d", &nbRequetes);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
bridges.cpp:54:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |   scanf("%d %d %d", &a, &b, &c);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...