제출 #1121491

#제출 시각아이디문제언어결과실행 시간메모리
1121491vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
20 / 100
169 ms10680 KiB
#include <bits/stdc++.h> using namespace std; #define ll int #define FORI(i, n) for(ll i = 0; i < n; i++) #define FOR(i, n) for(ll i = 1; i <= n; i++) typedef vector<ll> vl; typedef set<ll> setl; #define ff first #define ss second #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define db double #define nll cout << "\n" #define nl "\n" #define sync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); const ll mod = 1e9 + 7; const int MAX = 300000 + 5; const int imax = 2147483647; ll n, m, k, res, rnk[MAX]; ll a[MAX]; void solve(){ cin >> n >> m; FOR(i, n)cin >> a[i]; vl v1, v2; FOR(i, n / 2)v1.push_back(a[i]); vl a1, a2; for(ll i = n / 2 + 1; i <= n; i++)v2.push_back(a[i]); for(ll mask = 0; mask < (1 << v1.size()); mask++){ ll sum = 0; for(ll i = 0; i < v1.size(); i++){ if((1 << i) & mask)sum += v1[i ]; } a1.push_back(sum); } for(ll mask = 0; mask < (1 << v2.size()); mask++){ ll sum = 0; for(ll i = 0; i < v2.size(); i++){ if((1 << i) & mask)sum += v2[i]; } a2.push_back(sum); } sort(all(a2)); ll res = 0; for(auto i : a1){ res += (upper_bound(all(a2), m - i) - a2.begin()); } cout << res << nl; } signed main(){ // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); sync; ll t = 1; // cin >> t; FOR(i, t){ // cout << "Case #" << i << ": "; solve(); } }

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

bobek.cpp: In function 'void solve()':
bobek.cpp:32:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(ll i = 0; i < v1.size(); i++){
      |                       ~~^~~~~~~~~~~
bobek.cpp:39:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(ll i = 0; i < v2.size(); 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...
#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...