QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#695065 | #6604. Kobolds and Catacombs | Mocic1 | Compile Error | / | / | C++14 | 1.0kb | 2024-10-31 19:15:45 | 2024-10-31 19:15:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
//#define int long long
#define pb push_back
#define ff first
#define ss second
typedef pair<int, int> pi;
const int N = 3000007;
const int inf = 1e18;
const int mod = 1e9+7;
mt19937_64 rng(time(0));
int a[N],b[N],sum[N];
void solve()
{
int n;
cin>>n;
map<int,int>mp;
for(int i=1;i<=n;i++){cin>>a[i],b[i]=a[i],mp[a[i]]++;
sort(b+1,b+1+n);
for(int i=1;i<=n;i++){
int ip=lower_bound(b+1,b+n+1,a[i])-b;
int mn=min(i,ip);
int mx=max(i,ip);
sum[mn]++;
sum[mx]--;
}
int ans=0;
for(int i=1;i<=n;i++){
sum[i]=sum[i-1]+sum[i];
if(sum[i]==0){
ans++;
}
}
if(mp.size()==1){
cout<<n<<'\n';
}
else{
cout<<ans<<'\n';
}
}
signed main() {
ios;
int _ = 1;
//cin >> _;
while (_--) {
solve();
}
return 0;
}
詳細信息
answer.code:11:17: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+18’ to ‘2147483647’ [-Woverflow] 11 | const int inf = 1e18; | ^~~~ answer.code: In function ‘void solve()’: answer.code:46:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 46 | signed main() { | ^~ answer.code:46:12: note: remove parentheses to default-initialize a variable 46 | signed main() { | ^~ | -- answer.code:46:12: note: or replace parentheses with braces to value-initialize a variable answer.code:46:15: error: a function-definition is not allowed here before ‘{’ token 46 | signed main() { | ^ answer.code:54:2: error: expected ‘}’ at end of input 54 | } | ^ answer.code:18:1: note: to match this ‘{’ 18 | { | ^