답안 #711160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711160 2023-03-16T08:59:33 Z myrcella 사탕 분배 (IOI21_candies) C++17
3 / 100
1266 ms 14440 KB
//by szh
#include<bits/stdc++.h>
#include "candies.h"
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

const int maxn = 200010;

int n,m;
int hi[maxn];
vector <int> ans;

struct Q{
	int l,r,v;
}q[maxn];

vector <int> solve1() {
	rep(i,0,n) ans.pb(0);
	rep(i,0,m) {
		rep(j,q[i].l,q[i].r+1) {
			ans[j] += q[i].v;
			if (ans[j]<0) ans[j]=0;
			if (ans[j]>hi[j]) ans[j] = hi[j];
		}
	}
	return ans;
}

vector <int> solve2(){
	return ans;
}

vector <int> solve3() {
	return ans;
}

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    
    n = SZ(c),m = SZ(l);
    rep(i,0,n) hi[i] = c[i];
    rep(i,0,m) q[i].l = l[i],q[i].r = r[i], q[i].v = v[i];
    if (n<=2000) return solve1();
    bool check=true;
    rep(i,1,n) if (c[i]!=c[i-1]) check=false;
    if (check) return solve3();
    check=true;
    rep(i,0,m) if (v[i]<=0) check=false;
    if (check) return solve2();
    //subtask 4
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 392 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 83 ms 14440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 477 ms 10412 KB Output is correct
3 Incorrect 34 ms 4912 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1266 ms 10032 KB Output is correct
4 Incorrect 24 ms 3840 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 392 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Incorrect 83 ms 14440 KB Output isn't correct
7 Halted 0 ms 0 KB -