이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
using namespace std;
const ll maxn = 1e5 + 1;
ll n, k, H[41], G[41], a, cur, ans;
main ()
{
cin >> n >> k;
for (ll i = 1; i <= n; i ++)
{
cin >> H[i] >> G[i];
}
for (ll mask = 0; mask < pow (2, n); mask ++)
{
cur = 0, a = 0;
for (ll i = 1; i <= n; i ++)
{
if ((mask >> (i - 1)) % 2 == 1)
{
if (cur <= H[i])
{
a += G[i];
cur = H[i];
}
else
{
a = 0, cur = 0;
break;
}
}
}
if (a >= k)
ans ++;
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
san.cpp:8:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main ()
| ^| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |