This commit is contained in:
Zengtudor 2023-10-05 18:09:31 +08:00
parent e815910519
commit 89ea7a5350
35 changed files with 474 additions and 0 deletions

18
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

24
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/config/workspace/Luogu/P1540",
"program": "/config/workspace/Luogu/P1540/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

37
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,37 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wconversion",
"-Wnull-dereference",
"-Wsign-conversion"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false
}

View File

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

24
Cpp/Helloworld/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/config/workspace/Cpp/Helloworld",
"program": "/config/workspace/Cpp/Helloworld/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

37
Cpp/Helloworld/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,37 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wconversion",
"-Wnull-dereference",
"-Wsign-conversion"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false
}

BIN
Cpp/Helloworld/hello Executable file

Binary file not shown.

5
Cpp/Helloworld/hello.cpp Normal file
View File

@ -0,0 +1,5 @@
#include <iostream>
using namespace std;
int main(){
cout<<"Hello web server!!! \n from cpp"<<endl;
}

18
Luogu/.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

24
Luogu/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/config/workspace/Luogu/P3056",
"program": "/config/workspace/Luogu/P3056/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

41
Luogu/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wconversion",
"-Wnull-dereference",
"-Wsign-conversion"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"lldb.displayFormat": "auto",
"lldb.showDisassembly": "auto",
"lldb.dereferencePointers": true,
"lldb.consoleMode": "commands"
}

32
Luogu/P1190/P1190.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
const int MaxN = 1e4 + 5;
int N, M, W[MaxN], nowTime, ans;
priority_queue<int> prq, q;
int main() {
cin >> N >> M;
for (int i = 1; i <= N; i++) {
cin >> W[i];
ans = max(W[i],ans);
}
if (N<=M) {
cout<<ans<<endl;
return 0;
}
for (int i = 1; i <= M; i++) {
q.push(-W[i]);
}
for (int i = M + 1; i <= N; i++) {
int num = q.top();q.pop();
q.push(num-W[i]);
}
while (q.size() > 0) {
ans = max(ans, -q.top());
q.pop();
}
cout << ans << endl;
}

Binary file not shown.

BIN
Luogu/P1190/build/Debug/outDebug Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

34
Luogu/P1540/P1540.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int M,N;
int Ans=0;
queue<int> q;
int main(){
cin>>M>>N;
for (int i=1;i<=N; i++) {
int word;
cin>>word;
bool isIn = false;
auto nextq = q;
while (nextq.size()>0) {
if (nextq.front()==word) {
isIn=true;
break;
}
nextq.pop();
}
if (!isIn) {
Ans++;
q.push(word);
if (q.size()>M) {
q.pop();
}
}
}
cout<<Ans<<endl;
}

Binary file not shown.

BIN
Luogu/P1540/build/Debug/outDebug Executable file

Binary file not shown.

24
Luogu/P1803/P1803.cpp Normal file
View File

@ -0,0 +1,24 @@
#include <algorithm>
#include <iostream>
using namespace std;
const int MaxN = 1e6+5;
int n,nowT,ans;
struct _time{
int start,end;
}t[MaxN];
int main(){
cin>>n;
for (int i=1; i<=n; i++) {
cin>>t[i].start>>t[i].end;
}
sort(t+1,t+n+1,[](_time a,_time b){return a.end<b.end;});
for (int i=1; i<=n; i++) {
if (t[i].start>=nowT) {
ans++;
nowT=t[i].end;
}
}
cout<<ans<<endl;
}

Binary file not shown.

Binary file not shown.

7
Luogu/P1967/P1967.cpp Normal file
View File

@ -0,0 +1,7 @@
const int MaxM = 5e4+5;
int main(){
}

57
Luogu/P2330/P2330.cpp Normal file
View File

@ -0,0 +1,57 @@
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MaxN = 300+5;
const int MaxM = 1e4+5;
int Sum = 0;
int ansMax = -1e6;
struct _Edge{
int u;
int v;
int c;
}Edge[MaxM];
template<typename T>
struct _Union{
const int maxN=MaxM;
T f[MaxM];
_Union(){
for (T i=0; i<maxN; i++) {
f[i]=i;
}
}
T find(T n){
if (f[n]==n) {
return n;
}else {
T father = find(f[n]);
f[n]=father;
return father;
}
}
void merge(T a,T b){
f[find(b)] = find(a);
}
};
_Union<int> Union;
int main(){
int n,m;
cin>>n>>m;
for (int i=1; i<=m; i++) {
cin>>Edge[i].u>>Edge[i].v>>Edge[i].c;
}
sort(Edge+1,Edge+1+m,[](_Edge a,_Edge b){return a.c<b.c;});
for (int i=1; i<=m && Sum<= n-1; i++) {
if (Union.find(Edge[i].u)!=Union.find(Edge[i].v)) {
Union.merge(Edge[i].u, Edge[i].v);
Sum++;
ansMax=max(ansMax,Edge[i].c);
}
}
cout<<n-1<<" "<<ansMax<<endl;
}

Binary file not shown.

BIN
Luogu/P2330/build/Debug/outDebug Executable file

Binary file not shown.

BIN
Luogu/P2676/P2676 Executable file

Binary file not shown.

22
Luogu/P2676/P2676.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <algorithm>
#include <iostream>
using namespace std;
const int MaxN = 2e4 + 5;
int N, B, H[MaxN], ans, num;
int main() {
cin >> N >> B;
for (int i = 1; i <= N; i++) {
cin >> H[i];
}
sort(H + 1, H + 1 + N, [](int a, int b) { return a > b; });
do {
num++;
ans += H[num];
} while (ans < B);
cout<<num<<endl;
}

Binary file not shown.

Binary file not shown.

23
Luogu/P3056/P3056.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <iostream>
#include <string>
using namespace std;
string s;
int n;
int ans;
int main(){
cin>>s;
for (int i=0; i<s.length(); i++) {
if (s[i]=='(') {
n++;
}
if (s[i]==')') {
if (n==0) {
ans++;
}
n--;
}
}
cout<<ans-n<<" "<<ans<<" "<<n<<endl;
}

Binary file not shown.

BIN
Luogu/P3056/build/Debug/outDebug Executable file

Binary file not shown.

BIN
Luogu/P7285/P7285 Executable file

Binary file not shown.

29
Luogu/P7285/P7285.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cstring>
#include <iostream>
using namespace std;
int T;
int main() {
cin >> T;
for (int i = 1; i <= T; i++) {
int n;
cin>>n;
int zeroCount = 0;
for (int j=1; j<=n; j++) {
int input;
cin>>input;
if (input==0) {
zeroCount++;
}
}
cout<<n-zeroCount<<endl;
for (int j=1; j<=n; j++) {
cout<<1<<" ";
}
cout<<endl;
}
}