이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
#define double long double
using namespace std;
ll n;
ll nums[2005];
int check(ll v){
ll cur = 0;
ll sum = 0;
ll ans = 0;
while (cur<n){
ll flag = true;
FOR(i,cur,n){
sum += nums[i];
if ((sum&v) == sum) cur = i, flag=false;
}
if (flag) return -1;
cur += 1;
ans += 1;
sum = 0;
}
return ans;
}
int main(){
ll a,b;
cin >> n >> a >> b;
FOR(i,0,n) cin >> nums[i];
FOR(i,0,1000){
if (a<= check(i) && check(i) <= b){
cout << i;
break;
}
}
}
| # | 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... |