Submission #42721760
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int a[1100],f[1100];
void work()
{
int n,ans=0;
cin>>n;
for(int i=1; i<=n; i++)
scanf("%d", &a[i]);
memset(f, 0, sizeof(f));
for(int i=1; i<=n; i++)
for(int j=i+1; j<=n; j++)
if(a[i]>a[j])
f[i]=1;
for(int i=1; i<=n; i++) ans+=(!f[i]);
cout<<ans<<"\n";
}
int main()
{
int t;
cin>>t;
while(t-->0) work();
return 0;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Ekiden Race |
| User | LingChen |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 469 Byte |
| Status | AC |
| Exec Time | 9 ms |
| Memory | 3612 KiB |
Compile Error
./Main.cpp: In function ‘void work()’:
./Main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
11 | scanf("%d", &a[i]);
| ~~~~~^~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample-01.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, sample-01.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 9 ms | 3576 KiB |
| 001.txt | AC | 2 ms | 3572 KiB |
| 002.txt | AC | 2 ms | 3572 KiB |
| 003.txt | AC | 2 ms | 3500 KiB |
| 004.txt | AC | 2 ms | 3584 KiB |
| 005.txt | AC | 2 ms | 3496 KiB |
| 006.txt | AC | 2 ms | 3604 KiB |
| 007.txt | AC | 3 ms | 3484 KiB |
| 008.txt | AC | 3 ms | 3608 KiB |
| 009.txt | AC | 3 ms | 3580 KiB |
| 010.txt | AC | 2 ms | 3604 KiB |
| 011.txt | AC | 3 ms | 3580 KiB |
| 012.txt | AC | 2 ms | 3612 KiB |
| sample-01.txt | AC | 2 ms | 3500 KiB |