| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1110189 | vjudge1 | Fish 3 (JOI24_fish3) | C++17 | 2059 ms | 112556 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ff(i, a, b) for(auto i=(a); i<=(b); ++i)
#define ffr(i, b, a) for(auto i=(b); i>=(a); --i)
#define nl "\n"
#define ss " "
#define pb push_back
#define fi first
#define se second
#define sz(s) (int)s.size()
#define ms(a,x) memset(a, x, sizeof (a))
#define re exit(0)
#define cn continue
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const int mod=1e9+7;
//const int mod=998244353;
const int maxn=1e5+105;
const int maxm=4*maxn+5;
const ll inf=1e18;
mt19937 ran(time(0));
mt19937_64 ran64(time(0));
void rf(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if(fopen("o.inp","r")){
freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
}
}
void add(int &x, int y)
{
x+=y;
if(x>=mod) x-=mod;
if(x<0) x+=mod;
}
int n, q;
ll d, c[maxn];
signed main()
{
rf();
cin>>n>>d;
ff(i, 1, n) cin>>c[i];
cin>>q;
while(q--)
{
int l, r; cin>>l>>r;
ll x=inf, ans=0;
bool ok=1;
ffr(i, r, l)
{
if(c[i]>x)
{
ll s=(c[i]-x+d-1)/d;
if(c[i]<d*s)
{
ok=0; break;
}
x=c[i]-s*d;
ans+=s;
}
else x=c[i];
}
if(!ok) ans=-1;
cout<<ans<<nl;
}
re;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
