Submission #863861

# Submission time Handle Problem Language Result Execution time Memory
863861 2023-10-21T09:24:12 Z prairie2022 Sandcastle 2 (JOI22_ho_t5) C++17
9 / 100
20 ms 1464 KB
#include<bits/stdc++.h>
typedef long long ll;
#define fastio cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
using namespace std;

int main(){
    //fastio
    int h, w;
    cin >> h >> w;
    vector<int> val;
    vector<vector<int>> a(h, vector<int> (w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> a[i][j];
            val.push_back(a[i][j]);
        }
    }
    sort(val.begin(), val.end());
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++)
            a[i][j] = lower_bound(val.begin(), val.end(), a[i][j])-val.begin();
    }
    if(h>1) return 0;
    ll ans = 0;
    int cb;
    for(int j=0; j<w; j++){
        if(j && a[0][j-1]<a[0][j]) cb++;
        else cb = 1;
        ans += cb;
    }
    for(int j=0; j<w; j++){
        if(j && a[0][j-1]>a[0][j]) cb++;
        else cb = 0;
        ans += cb;
    }
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 17 ms 1088 KB Output is correct
3 Correct 19 ms 1464 KB Output is correct
4 Correct 17 ms 1432 KB Output is correct
5 Correct 17 ms 1244 KB Output is correct
6 Correct 20 ms 1428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -