답안 #892308

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892308 2023-12-25T07:08:59 Z AI_2512 금 캐기 (IZhO14_divide) C++17
0 / 100
0 ms 436 KB
#include <bits/stdc++.h>
using namespace std;
#define form(mt) for(auto vec:mt){for (auto el:vec){cout << el << " ";} cout << "\n";}
#define forv(vec) for (auto el:vec){cout <<el.second << " ";}

struct camp{
  int x, g, e;
};

signed main() {
  long long n, maxx = 0;
  cin >> n;
  vector<camp> vec(n);
  for (int i = 0; i< n; i++) cin >> vec[i].x >> vec[i].g >> vec[i].e;

  for (int i = 0; i<n; i++){
    long long esum=0,gsum=0,xsum=0, lastx = 0;
    int k = i;
    xsum-=vec[k].x;
    do{
      esum += vec[k].e;
      xsum += (vec[k].x-lastx);
      gsum += vec[k].g;
      lastx = vec[k].x;
      k++; 
    }while(esum >= xsum && k<=n-1);
    maxx = max(gsum, maxx);
  }
  cout << maxx;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 436 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 436 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 436 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -