update
This commit is contained in:
parent
80846a1f69
commit
2c879c469f
3
.gitignore
vendored
3
.gitignore
vendored
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
*.exe
|
*.exe
|
||||||
*.out
|
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
tempCodeRunnerFile
|
tempCodeRunnerFile
|
||||||
@ -43,3 +42,5 @@ day3/T433080/redo
|
|||||||
day3/T433080/out.txt
|
day3/T433080/out.txt
|
||||||
day2/U111091/out.txt
|
day2/U111091/out.txt
|
||||||
day2/U111091/fixed
|
day2/U111091/fixed
|
||||||
|
day4/T435167/T435167
|
||||||
|
day4/U461920/U461920
|
||||||
|
16
day4/T435167/1.in
Normal file
16
day4/T435167/1.in
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
5
|
||||||
|
4
|
||||||
|
10 20 20 30
|
||||||
|
0 1 0 1
|
||||||
|
3
|
||||||
|
3 1 2
|
||||||
|
0 1 1
|
||||||
|
4
|
||||||
|
2 2 4 8
|
||||||
|
1 1 1 1
|
||||||
|
3
|
||||||
|
5 15 4
|
||||||
|
0 0 0
|
||||||
|
4
|
||||||
|
20 10 100 50
|
||||||
|
1 0 0 1
|
9
day4/T435167/1.out
Normal file
9
day4/T435167/1.out
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
0
|
||||||
|
2
|
||||||
|
1 2
|
||||||
|
2 3
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
2
|
||||||
|
1 2
|
||||||
|
3 4
|
45
day4/T435167/T435167.cpp
Normal file
45
day4/T435167/T435167.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
//20% points
|
||||||
|
|
||||||
|
#include<bits/stdc++.h>
|
||||||
|
using namespace std;
|
||||||
|
#define int long long
|
||||||
|
|
||||||
|
const int MAX_N = 1e3+5;
|
||||||
|
int t,n;
|
||||||
|
int a[MAX_N],b[MAX_N];
|
||||||
|
|
||||||
|
bool checkAllEleGoUp(){
|
||||||
|
for(int i=2;i<=n;i++){
|
||||||
|
if (a[i]<a[i-1]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
signed main(){
|
||||||
|
cin>>t;
|
||||||
|
for(int i=1;i<=t;i++){
|
||||||
|
bool isAllBZero=true;
|
||||||
|
cin>>n;
|
||||||
|
for(int j=1;j<=n;j++){
|
||||||
|
cin>>a[j];
|
||||||
|
}
|
||||||
|
for(int j=1;j<=n;j++){
|
||||||
|
cin>>b[j];
|
||||||
|
if(b[j]!=0){
|
||||||
|
isAllBZero=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool isAllEleGoUp=checkAllEleGoUp();
|
||||||
|
if (isAllEleGoUp) {
|
||||||
|
cout<<0<<endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isAllBZero) {
|
||||||
|
cout<<-1<<endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cout<<0<<endl;
|
||||||
|
}
|
||||||
|
}
|
54
day4/U461920/U461920.cpp
Normal file
54
day4/U461920/U461920.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
//TODO fix bug input 3
|
||||||
|
//怀疑思路是否有问题,还是样例问题
|
||||||
|
|
||||||
|
#include<bits/stdc++.h>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define PRINT_VALUE(v){cout<<#v<<" :"<<v<<endl;}
|
||||||
|
#endif
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define PRINT_VALUE(v)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const int MAX_N=5*1e5+5;
|
||||||
|
int n,ans=0;
|
||||||
|
int num_times[MAX_N];
|
||||||
|
int arr[MAX_N];
|
||||||
|
|
||||||
|
void set_num_times_mem(){
|
||||||
|
for(int i=0;i<MAX_N;i++){
|
||||||
|
num_times[i]=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
cin>>n;
|
||||||
|
set_num_times_mem();
|
||||||
|
for(int i=1;i<=n;i++){
|
||||||
|
cin>>arr[i];
|
||||||
|
num_times[arr[i]]++;
|
||||||
|
PRINT_VALUE(i);
|
||||||
|
PRINT_VALUE(arr[i])
|
||||||
|
PRINT_VALUE(num_times[arr[i]]);
|
||||||
|
if (i==1) {
|
||||||
|
ans=max(num_times[arr[i]],ans);
|
||||||
|
}else{
|
||||||
|
if (i%2==0) {
|
||||||
|
int mid1=arr[i/2];
|
||||||
|
int mid2=arr[i/2+1];
|
||||||
|
PRINT_VALUE(mid1);
|
||||||
|
PRINT_VALUE(mid2);
|
||||||
|
ans=max(max(num_times[mid1],num_times[mid2])
|
||||||
|
,ans);
|
||||||
|
}else {
|
||||||
|
int mid=arr[i/2+1];
|
||||||
|
PRINT_VALUE(mid);
|
||||||
|
ans=max(num_times[mid],ans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PRINT_VALUE(ans);
|
||||||
|
PRINT_VALUE("------\n");
|
||||||
|
}
|
||||||
|
cout<<ans<<endl;
|
||||||
|
}
|
2
day4/U461920/sample-1.in
Normal file
2
day4/U461920/sample-1.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
7
|
||||||
|
1 2 3 1 2 1 3
|
1
day4/U461920/sample-1.out
Normal file
1
day4/U461920/sample-1.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
3
|
2
day4/U461920/sample-2.in
Normal file
2
day4/U461920/sample-2.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
9
|
||||||
|
1 1 2 3 4 3 2 1 1
|
1
day4/U461920/sample-2.out
Normal file
1
day4/U461920/sample-2.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
2
|
2
day4/U461920/sample-3.in
Normal file
2
day4/U461920/sample-3.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
14
|
||||||
|
2 6 2 5 3 4 2 1 4 3 5 6 3 2
|
1
day4/U461920/sample-3.out
Normal file
1
day4/U461920/sample-3.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
3
|
2
day4/U461920/sample-4.in
Normal file
2
day4/U461920/sample-4.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
99
|
||||||
|
85 88 94 94 59 47 63 75 75 40 38 35 59 56 81 48 96 47 46 34 96 62 35 46 83 34 95 34 69 48 15 10 3 92 67 34 38 92 84 84 42 49 86 63 82 65 39 89 80 14 34 69 55 42 67 34 68 86 15 72 18 96 2 7 1 89 16 68 65 97 52 38 92 34 87 16 2 62 34 18 34 74 34 8 21 77 45 8 2 14 49 36 48 12 6 34 39 42 36
|
1
day4/U461920/sample-4.out
Normal file
1
day4/U461920/sample-4.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
7
|
2
day4/U461920/sample-5.in
Normal file
2
day4/U461920/sample-5.in
Normal file
File diff suppressed because one or more lines are too long
1
day4/U461920/sample-5.out
Normal file
1
day4/U461920/sample-5.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
4
|
Loading…
Reference in New Issue
Block a user