Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
138341 谢思涵 学生排队 C++ 运行超时 60 1000 MS 2080 KB 486 2024-03-15 17:28:15

Tests(6/10):


#include <iostream> #define ll long long using namespace std; ll a[1000005], tot[1000005], cnt[1000005]; int main() { ll n; cin >> n; ll sum = 0; for(ll i = 1; i <= n; i++) { cin >> a[i]; cnt[i] = 1; } for(ll i = 1; i <= n; i++) { for(ll j = 1; j <= i; j++) { if(a[i] < a[j]) { tot[i] += cnt[i]; tot[j] += cnt[j]; cnt[i]++; cnt[j]++; } } } for(ll i = 1; i <= n; i++) sum += tot[i]; cout << sum << endl; return 0; }


测评信息: