제출 #1071064

#제출 시각아이디문제언어결과실행 시간메모리
1071064sleepntsheepArranging Tickets (JOI17_arranging_tickets)C++14
10 / 100
249 ms596 KiB
#include <stdio.h> #include <algorithm> using namespace std; int z = 1e9, n, m, a[22], b[22], p[22]; int main() { scanf("%d%d", &n, &m); for (int _, i = 0; i < m; ++i) { scanf("%d%d%d", a + i, b + i, &_), --a[i], --b[i]; if (a[i] > b[i]) swap(a[i], b[i]); } for (int j = 0; j < (1 << m); ++j) { for (int i = 0; i < n; ++i) p[i] = 0; for (int i = 0; i < m; ++i) { if ((j >> i) & 1) { ++p[a[i]], --p[b[i]]; } else { ++p[0], --p[a[i]], ++p[b[i]]; } } for (int i = 1; i < n; ++i) p[i] += p[i - 1]; int e = *max_element(p, p + n); if (z > e) z = e; } printf("%d", z); }

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

arranging_tickets.cpp: In function 'int main()':
arranging_tickets.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
arranging_tickets.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d%d", a + i, b + i, &_), --a[i], --b[i];
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...