# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
347905 | CaroLinda | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 465 ms | 21520 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x.size() )
const int MAX = 5e5+10 ;
using namespace std ;
struct Block
{
int speed, loc, tam ;
Block(int s=0, int l = 0, int t = 0 ) : speed(s), loc(l), tam(t) {}
} ;
int N , Q , T , L , R ;
int speed[MAX] ;
vector<Block> blocks ;
int main()
{
blocks.push_back(Block(1,0,1) ) ;
scanf("%d %d", &N, &Q ) ;
for(int i = 1 , d ; i <= N ; i++ )
{
scanf("%d", &d ) ;
if( d <= blocks.back().speed )
{
blocks.back().tam++ ;
continue ;
}
else
blocks.push_back( Block( ((d+blocks.back().speed-1)/blocks.back().speed)*blocks.back().speed, -i, 1) ) ;
}
for(int i = 1 ; i <= Q ; i++ )
{
scanf("%d %d %d", &T, &L, &R ) ;
int ans = 0 ;
for(auto e : blocks )
{
int a = e.loc + ( T/e.speed ) * e.speed ;
int b = a - e.tam + 1 ;
if( R < a ) a= R ;
if( L > b ) b = L ;
if( a >= b ) ans += a-b+1 ;
}
printf("%d\n", ans ) ;
}
}
컴파일 시 표준 에러 (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... |