제출 #856425

#제출 시각아이디문제언어결과실행 시간메모리
856425NiktopTug of War (BOI15_tug)C++14
18 / 100
829 ms1628 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define F first #define S second #define pb push_back #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #pragma GCC optimize ("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize ("-O2") const int N = 2e6+6; int32_t main() { int n, k; cin >> n >> k; int l[n*2], r[n*2], s[2*n]; for (int i = 0 ;i < 2*n; i++) cin >> l[i] >> r[i] >> s[i]; for (int i = 0; i < (1 << (2*n)); i++) { int x[2*n]; int kk = i; for (int j = 0; j < 2*n; j++) x[j] = kk % 2, kk /= 2; set<int> s1,s2; int sum1 = 0, sum2 = 0; for (int j = 0; j < 2*n; j++) { if (x[j] == 1) s1.insert(l[j]), sum1 += s[j]; else s2.insert(r[j]), sum2 += s[j]; } if (s1.size() == n && s2.size() == n && abs(sum1 - sum2) <= k) { cout << "YES"; return 0; } } cout << "NO"; }

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

tug.cpp: In function 'int32_t main()':
tug.cpp:39:23: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   39 |         if (s1.size() == n && s2.size() == n && abs(sum1 - sum2) <= k)
      |             ~~~~~~~~~~^~~~
tug.cpp:39:41: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   39 |         if (s1.size() == n && s2.size() == n && abs(sum1 - sum2) <= k)
      |                               ~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...