QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#730757 | #1479. Islands in the Data Stream | BackToSquare1 | 100 ✓ | 1ms | 3632kb | C++20 | 570b | 2024-11-09 21:29:32 | 2024-11-09 21:29:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve() {
int K;
cin >> K;
int a[15];
for(int i=0;i<15;i++) cin >> a[i];
int ans = 0;
for(int i=1;i<14;i++) {
for(int j=i;j<14;j++) {
int mn = 1e9;
for(int k=i;k<=j;k++) mn = min(mn,a[k]);
if(mn > a[i-1] && mn > a[j+1]) ans++;
}
}
// cout << "HI\n";
cout << K << ' ' << ans << '\n';
return;
}
int main() {
int P;
cin >> P;
for(int i=0;i<P;i++) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 100
Accepted
time: 1ms
memory: 3632kb
input:
15 1 0 0 1 1 2 2 1 1 0 1 2 2 1 1 0 2 0 1 2 3 4 3 2 1 2 3 4 3 2 1 0 3 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 4 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 5 0 1 2 3 2 3 4 3 2 1 0 1 2 1 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 7 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 8 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 9 0 0 0 0 0 1 2 3 2 1 0 0 0 0 0 10 0 1 2 ...
output:
1 4 2 7 3 7 4 7 5 7 6 1 7 1 8 2 9 3 10 7 11 1 12 2 13 0 14 7 15 6
result:
ok 15 lines