QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133350#4269. Rainy Markets0splei#0 172ms48076kbC++111.5kb2023-08-02 01:44:132024-07-04 02:35:34

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 02:35:34]
  • 评测
  • 测评结果:0
  • 用时:172ms
  • 内存:48076kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 01:44:13]
  • 提交

answer

#include <bits/stdc++.h>
 
using namespace std;
 
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii; 
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;
typedef vector <ll> vl;
typedef pair <ll, ll> LL;
typedef vector <LL> vll;
 
#define UNVISITED 0
#define VISITED 1
#define pb push_back
#define F first
#define S second

ll n, b, p, u, total=0;
vl tiene, gente, umbr, ans1, ans2, ans3;

void SOLVE(){
  cin >> n;

  for (ll i=0; i<n; i++) {
    cin >> b;
    tiene.pb(b);
    total+=b;
  }

  for (ll i=0; i<n-1; i++) {
    cin >> p;
    gente.pb(p);
    total-=p;
  }

  for (ll i=0; i<n-1; i++) {
    cin >> u;
    umbr.pb(u);
  }

  if (total<0) {
    cout << "NO\n";
    return;
  }

  bool puede=true;

  for (ll i=0; i<n-1; i++){
    if (tiene[i]>0) {
      ll resta=max(gente[i]-tiene[i], (ll) 0);
      ans1.pb(gente[i]-resta);
      gente[i]=resta;
    }

    if (tiene[i+1]<gente[i]){
      cout << "NO\n";
      return;
    }

    ll resta=max(gente[i]-tiene[i+1], (ll) 0);
    ans3.pb(gente[i]-resta);
    tiene[i+1]=max(tiene[i+1]-gente[i], (ll) 0);
    gente[i]=0;
  }

  cout << "YES\n";
  cout << "0\n";

  for (ll i=0; i<n-1; i++){
    cout << ans1[i] << " 0 " << ans3[i] << "\n";
  }
}
 
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  while(t--){
    SOLVE();
  }
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 0ms
memory: 3652kb

input:

3
10 15 10
20 20
0 0

output:

NO

result:

ok IMPOSSIBLE

Test #2:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2
813741488 132495829
946237313
0

output:

YES
0
813741488 0 132495825

result:

ok good plan

Test #3:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

2
175700937 435906025
546265275
0

output:

YES
0
175700937 0 370564338

result:

ok good plan

Test #4:

score: 0
Accepted
time: 129ms
memory: 31892kb

input:

1000000
999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 99999...

output:

NO

result:

ok IMPOSSIBLE

Test #5:

score: 0
Accepted
time: 145ms
memory: 33788kb

input:

1000000
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 50...

output:

NO

result:

ok IMPOSSIBLE

Test #6:

score: 0
Accepted
time: 124ms
memory: 32660kb

input:

1000000
999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 99999...

output:

NO

result:

ok IMPOSSIBLE

Test #7:

score: 0
Accepted
time: 141ms
memory: 32344kb

input:

1000000
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 50...

output:

NO

result:

ok IMPOSSIBLE

Test #8:

score: 0
Accepted
time: 2ms
memory: 3848kb

input:

4000
371896518 731935279 428414487 878930842 569178148 826228818 1000783912 686784551 510567707 203391729 232379073 1351183869 429219170 767480826 351913312 143053268 871061720 171086334 342694087 784356999 505826785 816153880 512894008 199747092 526361485 936149088 572347607 543039867 480605813 967...

output:

YES
0
371896518 0 345249820
386685459 0 362308188
66106299 0 473313580
405617262 0 180574503
388603645 0 458982202
367246616 0 575000419
425783493 0 355865390
330919161 0 379939779
130627928 0 56406124
146985605 0 157230285
75148788 0 770513948
580669921 0 33222618
395996552 0 459383357
308097469 0 ...

result:

ok good plan

Test #9:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

4000
272373873 140697311 935891972 459510485 380217614 889215567 852306701 971803793 240167795 156812678 430652906 1311456239 1008344772 440041142 623974894 450082368 796550780 952767338 836068185 1145186862 273207527 1390469317 568188650 409763894 1342431187 848500582 958109270 564107379 763581098 ...

output:

YES
0
272373873 0 25945708
114751603 0 692287352
223159716 0 0
420496167 0 0
380217614 0 586382179
302833388 0 259549219
592757482 0 155581828
814606373 0 0
157875190 0 0
156812678 0 64831972
365820934 0 631588619
679867620 0 132962752
814116034 0 0
440041142 0 248961401
290877953 0 0
450082368 0 10...

result:

ok good plan

Test #10:

score: -5
Wrong Answer
time: 172ms
memory: 48076kb

input:

1000000
10 4 9 9 15 6 3 15 3 8 11 13 6 17 7 13 5 4 8 8 14 3 10 11 6 12 8 9 7 15 15 2 8 3 9 8 13 6 2 4 9 8 7 10 4 12 6 12 2 14 4 12 8 5 9 7 4 12 1 13 6 13 3 6 9 14 9 5 13 3 13 6 9 10 8 5 12 7 1 7 7 7 10 7 13 3 11 14 5 8 6 4 4 6 17 2 4 5 6 3 5 18 10 1 15 7 3 2 3 11 5 8 5 4 7 19 2 13 15 7 11 4 13 7 9 1...

output:

YES
0
10 0 0
4 0 3
6 0 3
6 0 0
10 0 0
4 0 0
3 0 5
9 0 0
3 0 3
5 0 5
6 0 1
9 0 0
6 0 4
10 0 0
7 0 2
8 0 0
3 0 0
4 0 3
5 0 3
5 0 5
6 0 0
3 0 5
5 0 4
7 0 2
4 0 3
9 0 0
8 0 2
5 0 0
7 0 3
7 0 0
10 0 0
2 0 1
6 0 0
3 0 3
6 0 1
7 0 1
6 0 0
6 0 1
1 0 3
1 0 3
6 0 3
5 0 2
5 0 5
2 0 0
4 0 4
8 0 1
5 0 1
8 0 0
2 ...

result:

wrong answer the number of people at marked 10 is 13, but you planned 10

Subtask #2:

score: 0
Wrong Answer

Test #36:

score: 0
Wrong Answer
time: 0ms
memory: 3720kb

input:

3
10 15 10
20 20
0 11

output:

NO

result:

wrong answer read 'NO' but expected 'YES'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%