Skip to content

Commit 3595261

Browse files
committed
Codeforces Round 1093 (Div. 1)
1 parent 02e6fb3 commit 3595261

11 files changed

Lines changed: 644 additions & 129 deletions

File tree

‎.vscode/Code.code-workspace‎

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"folders": [
3+
{
4+
"name": "_work",
5+
"path": "../_work"
6+
},
7+
{
8+
"name": "Code",
9+
"path": ".."
10+
}
11+
],
12+
"extensions": {
13+
"recommendations": [
14+
"llvm-vs-code-extensions.vscode-clangd",
15+
"ms-python.python",
16+
"vadimcn.vscode-lldb",
17+
]
18+
},
19+
"launch": {
20+
"version": "0.2.0",
21+
"configurations": [
22+
{
23+
"name": "LLDB Debug",
24+
"type": "lldb",
25+
"request": "launch",
26+
"program": "${fileDirname}/${fileBasenameNoExtension}",
27+
"args": [],
28+
"cwd": "${fileDirname}",
29+
"sourceLanguages": [
30+
"C++"
31+
],
32+
"preLaunchTask": "LLDB Build"
33+
},
34+
]
35+
},
36+
"settings": {
37+
"cph.general.defaultLanguage": "cpp",
38+
"cph.general.ignoreSTDERROR": true,
39+
"cph.general.showLiveUserCount": true,
40+
"cph.general.timeOut": 8000,
41+
"cph.general.useShortAtCoderName": true,
42+
"cph.general.useShortCodeForcesName": true,
43+
"cph.general.useShortLuoguName": true,
44+
"cph.language.cpp.Command": "clang++",
45+
"cph.language.cpp.Args": "-Wall -Wextra -O2 -DLOCAL",
46+
"git.allowForcePush": true,
47+
"git.detectSubmodules": false,
48+
"lldb.launch.sourceLanguages": [
49+
"cpp"
50+
],
51+
},
52+
"tasks": {
53+
"version": "2.0.0",
54+
"tasks": [
55+
{
56+
"label": "C++ Compile (LLDB)",
57+
"type": "shell",
58+
"group": {
59+
"kind": "test"
60+
},
61+
"command": "clang++",
62+
"args": [
63+
"'${fileBasename}'",
64+
"-o",
65+
"'${fileBasenameNoExtension}'",
66+
"-std=c++23",
67+
"-Wall",
68+
"-Wextra",
69+
"-O2",
70+
"-DLOCAL",
71+
],
72+
"options": {
73+
"cwd": "${fileDirname}"
74+
},
75+
"presentation": {
76+
"panel": "dedicated"
77+
}
78+
},
79+
{
80+
"label": "C++ Run",
81+
"type": "shell",
82+
"group": {
83+
"kind": "test"
84+
},
85+
"command": "./'${fileBasenameNoExtension}' && rm '${fileBasenameNoExtension}'",
86+
"options": {
87+
"cwd": "${fileDirname}"
88+
},
89+
"presentation": {
90+
"panel": "dedicated",
91+
"focus": true,
92+
"showReuseMessage": false
93+
}
94+
},
95+
{
96+
"label": "C++ Compile & Run (LLDB)",
97+
"type": "shell",
98+
"group": {
99+
"kind": "test",
100+
"isDefault": true
101+
},
102+
"dependsOn": [
103+
"C++ Compile (LLDB)",
104+
"C++ Run"
105+
],
106+
"dependsOrder": "sequence",
107+
"options": {
108+
"cwd": "${fileDirname}"
109+
},
110+
"presentation": {
111+
"panel": "dedicated",
112+
"focus": true,
113+
"showReuseMessage": false
114+
}
115+
},
116+
{
117+
"label": "LLDB Build",
118+
"type": "shell",
119+
"command": "clang++",
120+
"args": [
121+
"'${fileBasename}'",
122+
"-o",
123+
"'${fileBasenameNoExtension}'",
124+
"-glldb",
125+
"-std=c++23",
126+
"-Wall",
127+
"-Wextra",
128+
"-O2",
129+
"-DLOCAL"
130+
],
131+
"options": {
132+
"cwd": "${fileDirname}"
133+
},
134+
"problemMatcher": {
135+
"owner": "lldb",
136+
"pattern": {
137+
"regexp": "^(.*\\.cpp):(\\d+):(\\d+): (.*)$",
138+
"file": 1,
139+
"line": 2,
140+
"column": 3,
141+
"message": 4
142+
},
143+
}
144+
}
145+
],
146+
}
147+
}

‎.vscode/extensions.json‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎.vscode/launch.json‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎.vscode/settings.json‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎.vscode/tasks.json‎

Lines changed: 0 additions & 95 deletions
This file was deleted.

‎Codeforces/2219A.cpp‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* @file 2219A.cpp
3+
* @author Macesuted (i@macesuted.moe)
4+
* @date 2026-04-13
5+
*
6+
* @copyright Copyright (c) 2026
7+
*
8+
*/
9+
10+
#include <bits/stdc++.h>
11+
using namespace std;
12+
13+
#ifndef LOCAL
14+
#define endl '\n'
15+
#endif
16+
17+
bool mem1;
18+
19+
void solve(void) {
20+
int p, q;
21+
cin >> p >> q;
22+
23+
int sum = p + 2 * q;
24+
for (int n = 1; n * n <= sum; n++) {
25+
if ((sum - n) % (2 * n + 1)) continue;
26+
int m = (sum - n) / (2 * n + 1);
27+
28+
if (p >= abs(n - m)) return cout << n << ' ' << m << endl, void();
29+
}
30+
31+
cout << -1 << endl;
32+
33+
return;
34+
}
35+
36+
bool mem2;
37+
38+
int main() {
39+
ios::sync_with_stdio(false), cin.tie(nullptr);
40+
#ifdef LOCAL
41+
cerr << "Memory Cost: " << abs(&mem1 - &mem2) / 1024. / 1024. << "MB" << endl;
42+
#endif
43+
44+
int _ = 1;
45+
cin >> _;
46+
while (_--) solve();
47+
48+
#ifdef LOCAL
49+
cerr << "Time Cost: " << clock() * 1000. / CLOCKS_PER_SEC << "MS" << endl;
50+
#endif
51+
return 0;
52+
}

0 commit comments

Comments
 (0)