답안 #897545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897545 2024-01-03T11:32:01 Z bleahbleah Security Guard (JOI23_guard) C++17
0 / 100
13 ms 1660 KB
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;

using ll = long long;
using ld = long double;

//#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<int,int>;
using tii = tuple<int,int,int>;

vector<int> S;

signed main() {
  cin.tie(0) -> sync_with_stdio(0);
  int n, m, q;
  cin >> n >> m >> q;
  S.resize(n);
  
  for(auto &x : S) cin >> x;
  
  ll sum = 0, cnt = 0;
  for(int i = 0; i < n - 1; i++) {
    sum += max(S[i], S[i + 1]);
    if(S[i] != S[i + 1]) {
      cnt ^= 1;
      if(cnt == 1) sum--;
    }
  }
  
  cout << sum << '\n';
  
  
}

/**
      nu toate numerele mari sunt semne de ceva bine
      -- Si pe mine m-a surprins sa fiu sincer, dar pbn cautati pe net, sunt sigur ca se gasesc mai multe exemple
*/

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 8 ms 1628 KB Output is correct
3 Correct 8 ms 1660 KB Output is correct
4 Incorrect 13 ms 1628 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 8 ms 1628 KB Output is correct
3 Correct 8 ms 1660 KB Output is correct
4 Incorrect 13 ms 1628 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 8 ms 1628 KB Output is correct
3 Correct 8 ms 1660 KB Output is correct
4 Incorrect 13 ms 1628 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 8 ms 1628 KB Output is correct
3 Correct 8 ms 1660 KB Output is correct
4 Incorrect 13 ms 1628 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 8 ms 1628 KB Output is correct
3 Correct 8 ms 1660 KB Output is correct
4 Incorrect 13 ms 1628 KB Output isn't correct
5 Halted 0 ms 0 KB -