Submission #983800

# Submission time Handle Problem Language Result Execution time Memory
983800 2024-05-16T06:30:11 Z vjudge1 Group Photo (JOI21_ho_t3) C++17
0 / 100
1 ms 348 KB
//48 - 0
//97 - a
//65 - A
#include<bits/stdc++.h>
using namespace std;
#define osh_suht ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main(){
    osh_suht
    //freopen("INPUT.TXT", "r", stdin);
    //freopen("OUTPUT.TXT", "w", stdout);
    //cout <<fixed;
    //cout.precision(2);
    int n;
    cin >>n;
    int h[n], ans = 0;;
    for (int i = 0; i <= n - 1; i ++)
        cin >>h[i];

    for (int i = 0; i <= n - 2; i ++){
        if (h[i] >= h[i + 1] + 2){
            swap(h[i], h[i + 1]);
            i = -1;
            ans ++;
        }
    }

    cout <<ans <<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -