제출 #294902

#제출 시각아이디문제언어결과실행 시간메모리
294902BTheroArranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
975 ms512 KiB
// chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; vector<int> arr[25]; int cnt[25]; int n, m; void solve() { scanf("%d %d", &n, &m); for (int i = 0; i < m; ++i) { int a, b, c; scanf("%d %d %d", &a, &b, &c); assert(c == 1); --a; --b; while (a != b) { arr[i].pb(a); a = (a + 1) % n; } } int ans = m; for (int mask = 0; mask < (1 << m); ++mask) { fill(cnt, cnt + n, 0); for (int i = 0; i < m; ++i) { int x = 1; if ((mask >> i) & 1) { for (int j = 0; j < n; ++j) { cnt[j]++; } x = -x; } for (int y : arr[i]) { cnt[y] += x; } } ans = min(ans, *max_element(cnt, cnt + n)); } printf("%d\n", ans); } int main() { int tt = 1; while (tt--) { solve(); } return 0; }

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

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