제출 #408255

#제출 시각아이디문제언어결과실행 시간메모리
408255Mamnoon_SiamArranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
1287 ms296 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; #define all(v) begin(v), end(v) #define sz(v) (int)(v).size() #define fi first #define se second int main(int argc, char const *argv[]) { #ifdef LOCAL freopen("in", "r", stdin); #endif int n, m; scanf("%d %d", &n, &m); vi a(m), b(m), c(m); for(int i = 0; i < m; ++i) { scanf("%d %d %d", &a[i], &b[i], &c[i]); a[i]--, b[i]--; } ll ans = LLONG_MAX; for(int msk = 0; msk < (1 << m); ++msk) { vector<ll> cnt(n); for(int i = 0; i < m; ++i) { int from = a[i], to = b[i]; if(msk >> i & 1) swap(from, to); for(int j = from; j != to; j = (j+1)%n) { cnt[j] += c[i]; } } ans = min(ans, *max_element(all(cnt))); } printf("%lld\n", ans); return 0; } /* * use std::array instead of std::vector, if u can * overflow? * array bounds */

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

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