QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#127710 | #6604. Kobolds and Catacombs | white2718 | WA | 157ms | 11412kb | C++14 | 920b | 2023-07-19 22:33:13 | 2023-07-19 22:33:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
# define ll long long
# define inf 1000000000
const ll mod = 1000000007;
const double pi = 3.141592653589793;
inline int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
inline int lcm(int n, int m) { return n * m / gcd(n, m); }
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
for (; b; b >>= 1) {
if (b & 1)res = res * a % mod;
a = a * a % mod;
}
return res;
}
int n;
struct A{
int id,v;
bool operator <(const A &a)const {
if(a.v==v)return id<a.id;
return v<a.v;
}
}a[1000010];
int main() {
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&a[i].v);
a[i].id=i;
}
sort(a+1,a+1+n);
int ans=0,now=0;
for(int i=1;i<=n;i++){
if(a[i].id<now)continue;
now=a[i].id;
ans++;
}
printf("%d",ans);
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3824kb
input:
5 1 3 2 7 4
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: -100
Wrong Answer
time: 157ms
memory: 11412kb
input:
1000000 524227301 431992275 758916082 293029389 719487809 413407585 7533705 414925441 87316769 639877621 980912701 739058961 277730843 958292661 778325685 500280161 782766985 339709027 1968001 842653531 847517701 989893001 97622801 728458741 612188545 787566057 981715521 281901909 804267925 89113887...
output:
105
result:
wrong answer 1st numbers differ - expected: '1', found: '105'