QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#185775 | #6434. Paimon Sorting | TJSW | WA | 0ms | 3616kb | C++14 | 1.7kb | 2023-09-22 16:31:37 | 2023-09-22 16:31:37 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 998244353
#define ffor(n) for(int i = 0;i < n;++i)
const int N = 2000006;
using namespace std;
void build_log();
int mv_x[4] = {1,0,-1,0};
int mv_y[4] = {0,1,0,-1};
int year[2][15] = {{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};//1æ¯é°å¹´,0æ¯éé°å¹´
int t;
int m_log2[500005]; // log2(x) + 1
int k;
int n,m;
int h;
signed main()
{
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
cin>>t;
while(t--)
{
cin>>n;
stack<int>st;
int sum = 0;
int a;
ffor(n)
{
cin>>a;
if(i == 0)
{
st.push(a);
}
else
{
while(!st.empty())
{
if(st.top() <= a)
{
st.pop();
}
else
{
break;
}
}
if(st.empty())
{
sum += 2;
st.push(a);
}
else
{
sum += st.size();
st.push(a);
}
}
cout<<sum<<' ';
}
cout<<endl;
}
return 0;
}
void build_log()
{
for(int i = 1;i <= n;i++)
{
m_log2[i] = m_log2[i-1] + ((1 << m_log2[i-1]) == i);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
input:
3 5 2 3 2 1 5 3 1 2 3 1 1
output:
0 2 3 5 7 0 2 4 0
result:
wrong answer 1st lines differ - expected: '0 2 3 5 7', found: '0 2 3 5 7 '