QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133353#4269. Rainy Markets0splei#Compile Error//C++111.4kb2023-08-02 01:47:292024-07-04 01:10:05

Judging History

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

  • [2024-07-04 01:10:05]
  • 评测
  • [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:47:29]
  • 提交

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++){
    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);
  }

  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();
  }
}

詳細信息

answer.code: In function ‘void SOLVE()’:
answer.code:62:8: error: redeclaration of ‘ll resta’
   62 |     ll resta=max(gente[i]-tiene[i+1], (ll) 0);
      |        ^~~~~
answer.code:53:8: note: ‘ll resta’ previously declared here
   53 |     ll resta=max(gente[i]-tiene[i], (ll) 0);
      |        ^~~~~