Precreation contest files
This commit is contained in:
22
misc/hsg-hn-2025/.vscode/launch.json
vendored
Normal file
22
misc/hsg-hn-2025/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug C++ (input.inp)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/${fileBasenameNoExtension}",
|
||||
"args": ["<", "${fileBasenameNoExtension}.inp"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "Build C++",
|
||||
"MIMode": "gdb",
|
||||
"externalConsole": false,
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty printing",
|
||||
"text": "-enable-pretty-printing"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
22
misc/hsg-hn-2025/.vscode/tasks.json
vendored
Normal file
22
misc/hsg-hn-2025/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build C++",
|
||||
"type": "shell",
|
||||
"command": "g++",
|
||||
"args": [
|
||||
"-std=gnu++17",
|
||||
"-O2",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileBasenameNoExtension}"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
misc/hsg-hn-2025/a.out
Executable file
BIN
misc/hsg-hn-2025/a.out
Executable file
Binary file not shown.
BIN
misc/hsg-hn-2025/denlong
Executable file
BIN
misc/hsg-hn-2025/denlong
Executable file
Binary file not shown.
17
misc/hsg-hn-2025/denlong.cpp
Normal file
17
misc/hsg-hn-2025/denlong.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n, k, x;
|
||||
cin >> n >> k >> x;
|
||||
vector<vector<int>> hash(9, vector<int>(n, 0));
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
int a;
|
||||
cin >> a;
|
||||
if (i == 0)
|
||||
hash[a][i] = 1;
|
||||
else
|
||||
hash[a][i] = hash[a][i - 1] + 1;
|
||||
}
|
||||
}
|
||||
2
misc/hsg-hn-2025/denlong.inp
Normal file
2
misc/hsg-hn-2025/denlong.inp
Normal file
@@ -0,0 +1,2 @@
|
||||
6 2 2
|
||||
1 9 3 2 3 5
|
||||
0
misc/hsg-hn-2025/denlong.out
Normal file
0
misc/hsg-hn-2025/denlong.out
Normal file
35
misc/hsg-hn-2025/muasam.cpp
Normal file
35
misc/hsg-hn-2025/muasam.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
const int MAX_N = 1e6;
|
||||
int a[MAX_N];
|
||||
|
||||
int main() {
|
||||
freopen("muasam.inp", "r", stdin);
|
||||
freopen("muasam.out", "w", stdout);
|
||||
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int n, l, r;
|
||||
cin >> n >> l >> r;
|
||||
for (int i = 0; i < n; i++)
|
||||
cin >> a[i];
|
||||
int res = 1e9;
|
||||
|
||||
sort(a, a + n);
|
||||
int L = 0, R = n - 1;
|
||||
while (L < R) {
|
||||
int sum = a[L] + a[R];
|
||||
if (sum > r)
|
||||
R--;
|
||||
else if (sum < l)
|
||||
L++;
|
||||
else {
|
||||
res = min(res, sum);
|
||||
R--;
|
||||
}
|
||||
}
|
||||
cout << res << '\n';
|
||||
}
|
||||
Reference in New Issue
Block a user