답안 #282151

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282151 2020-08-24T04:47:13 Z 최은수(#5756) 방벽 (JOI15_walls) C++17
10 / 100
3000 ms 1324 KB
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int a[100010],b[100010];
ll ans[100010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i],b[i]-=a[i];
    for(int i=0;i<m;i++)
    {
        int p;
        cin>>p;
        for(int j=0;j<n;j++)
        {
            if(a[j]>p)
                ans[j]+=a[j]-p,a[j]=p;
            if(a[j]+b[j]<p)
                ans[j]+=p-a[j]-b[j],a[j]=p-b[j];
        }
    }
    for(int i=0;i<n;i++)
        cout<<ans[i]<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 24 ms 640 KB Output is correct
3 Correct 25 ms 768 KB Output is correct
4 Correct 26 ms 768 KB Output is correct
5 Correct 27 ms 768 KB Output is correct
6 Correct 25 ms 768 KB Output is correct
7 Correct 23 ms 768 KB Output is correct
8 Correct 23 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1862 ms 1324 KB Output is correct
2 Execution timed out 3047 ms 1024 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 24 ms 640 KB Output is correct
3 Correct 25 ms 768 KB Output is correct
4 Correct 26 ms 768 KB Output is correct
5 Correct 27 ms 768 KB Output is correct
6 Correct 25 ms 768 KB Output is correct
7 Correct 23 ms 768 KB Output is correct
8 Correct 23 ms 768 KB Output is correct
9 Correct 1862 ms 1324 KB Output is correct
10 Execution timed out 3047 ms 1024 KB Time limit exceeded
11 Halted 0 ms 0 KB -