# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896964 | 2024-01-02T11:34:02 Z | AndrijaM | Pancake (NOI12_pancake) | C++17 | 15 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; int n; while(t--) { cin>>n; vector<int>v; for(int i=0;i<n;i++) { int num; cin>>num; v.push_back(num); } reverse(v.begin(),v.end()); vector<int>s; s=v; sort(s.begin(),s.end()); if(v==s) { cout<<0<<endl; } else { int ans=0; vector<int>pom; for(int i=1;i<v.size();i++) { if(v[i]>v[i-1]) { for(int j=i-1;j>=0;j--) { pom.push_back(v[j]); } for(int j=i;j<v.size();j++) { pom.push_back(v[j]); } if(pom==s) { ans=1; break; } else { ans=2; break; } } } cout<<ans<<endl; } } return 0; }
Compilation message
# | 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 | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |