Sun, 27 Jan 2019 20:34:02 +0800

master
大蒟蒻 7 years ago
parent a644f8f567
commit b9c960a337

@ -0,0 +1,35 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build current"
}
]
}

@ -0,0 +1,68 @@
{
"python.formatting.provider": "yapf",
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cuchar": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"fstream": "cpp",
"functional": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"scoped_allocator": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"thread": "cpp",
"type_traits": "cpp",
"tuple": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"valarray": "cpp"
}
}

18
.vscode/tasks.json vendored

@ -0,0 +1,18 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build current",
"type": "shell",
"command": "g++",
"args": [
"-std=c++2a",
"-Wall",
"-g",
"${file}"
]
}
]
}

@ -0,0 +1,28 @@
#include <bits/stdc++.h>
using namespace std;
int main()
{
map<string, map<string, int>> M;
int n, m, x;
cin >> n;
string s1, s2;
while (n--)
{
M.clear();
cin >> m;
while (m--)
{
cin >> s1 >> s2 >> x;
M[s2][s1] += x;
}
for (auto &x : M)
{
cout << x.first << endl;
for (auto &y : x.second)
cout << " |----" << y.first << '(' << y.second << ')' << endl;
}
if (n)
cout << endl;
}
return 0;
}

@ -0,0 +1,41 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
tuple<int, int, int, int> a[N << 1];
unsigned long long best[N];
int main()
{
memset(best, 0x3f, sizeof(best));
int n, x;
scanf("%d%d", &n, &x);
for (int i = 0, x, y, z; i < n; i++)
{
scanf("%d%d%d", &x, &y, &z);
a[i << 1] = {x, -1, y, z};
a[i << 1 | 1] = {y, 1, x, z};
}
n <<= 1;
sort(a, a + n);
auto ans = numeric_limits<unsigned long long>::max();
for (int i = 0; i < n; i++)
{
int l, r, t, c;
tie(l, t, r, c) = a[i];
if (t == -1)
{
int time = r - l + 1;
if (time <= x)
ans = min(ans, c + best[x - time]);
}
if (t == 1)
{
int time = l - r + 1;
best[time] = min(best[time], (unsigned long long)c);
}
//printf("** %d %d %d %d %lld\n", l, r, t, c, ans);
}
if (ans >= 2e9 + 2)
ans = -1ll;
printf("%lld", ans);
return 0;
}

@ -0,0 +1,414 @@
.file "B.cpp"
.intel_syntax noprefix
.text
.section .rodata
.type _ZStL19piecewise_construct, @object
.size _ZStL19piecewise_construct, 1
_ZStL19piecewise_construct:
.zero 1
.type _ZStL13allocator_arg, @object
.size _ZStL13allocator_arg, 1
_ZStL13allocator_arg:
.zero 1
.type _ZStL6ignore, @object
.size _ZStL6ignore, 1
_ZStL6ignore:
.zero 1
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.align 4
.type _ZN9__gnu_cxxL21__default_lock_policyE, @object
.size _ZN9__gnu_cxxL21__default_lock_policyE, 4
_ZN9__gnu_cxxL21__default_lock_policyE:
.long 2
.type _ZStL10defer_lock, @object
.size _ZStL10defer_lock, 1
_ZStL10defer_lock:
.zero 1
.type _ZStL11try_to_lock, @object
.size _ZStL11try_to_lock, 1
_ZStL11try_to_lock:
.zero 1
.type _ZStL10adopt_lock, @object
.size _ZStL10adopt_lock, 1
_ZStL10adopt_lock:
.zero 1
.align 4
.type _ZNSt15regex_constantsL5icaseE, @object
.size _ZNSt15regex_constantsL5icaseE, 4
_ZNSt15regex_constantsL5icaseE:
.long 1
.align 4
.type _ZNSt15regex_constantsL6nosubsE, @object
.size _ZNSt15regex_constantsL6nosubsE, 4
_ZNSt15regex_constantsL6nosubsE:
.long 2
.align 4
.type _ZNSt15regex_constantsL8optimizeE, @object
.size _ZNSt15regex_constantsL8optimizeE, 4
_ZNSt15regex_constantsL8optimizeE:
.long 4
.align 4
.type _ZNSt15regex_constantsL7collateE, @object
.size _ZNSt15regex_constantsL7collateE, 4
_ZNSt15regex_constantsL7collateE:
.long 8
.align 4
.type _ZNSt15regex_constantsL10ECMAScriptE, @object
.size _ZNSt15regex_constantsL10ECMAScriptE, 4
_ZNSt15regex_constantsL10ECMAScriptE:
.long 16
.align 4
.type _ZNSt15regex_constantsL5basicE, @object
.size _ZNSt15regex_constantsL5basicE, 4
_ZNSt15regex_constantsL5basicE:
.long 32
.align 4
.type _ZNSt15regex_constantsL8extendedE, @object
.size _ZNSt15regex_constantsL8extendedE, 4
_ZNSt15regex_constantsL8extendedE:
.long 64
.align 4
.type _ZNSt15regex_constantsL3awkE, @object
.size _ZNSt15regex_constantsL3awkE, 4
_ZNSt15regex_constantsL3awkE:
.long 128
.align 4
.type _ZNSt15regex_constantsL4grepE, @object
.size _ZNSt15regex_constantsL4grepE, 4
_ZNSt15regex_constantsL4grepE:
.long 256
.align 4
.type _ZNSt15regex_constantsL5egrepE, @object
.size _ZNSt15regex_constantsL5egrepE, 4
_ZNSt15regex_constantsL5egrepE:
.long 512
.align 4
.type _ZNSt15regex_constantsL12__polynomialE, @object
.size _ZNSt15regex_constantsL12__polynomialE, 4
_ZNSt15regex_constantsL12__polynomialE:
.long 1024
.align 4
.type _ZNSt15regex_constantsL13match_defaultE, @object
.size _ZNSt15regex_constantsL13match_defaultE, 4
_ZNSt15regex_constantsL13match_defaultE:
.zero 4
.align 4
.type _ZNSt15regex_constantsL13match_not_bolE, @object
.size _ZNSt15regex_constantsL13match_not_bolE, 4
_ZNSt15regex_constantsL13match_not_bolE:
.long 1
.align 4
.type _ZNSt15regex_constantsL13match_not_eolE, @object
.size _ZNSt15regex_constantsL13match_not_eolE, 4
_ZNSt15regex_constantsL13match_not_eolE:
.long 2
.align 4
.type _ZNSt15regex_constantsL13match_not_bowE, @object
.size _ZNSt15regex_constantsL13match_not_bowE, 4
_ZNSt15regex_constantsL13match_not_bowE:
.long 4
.align 4
.type _ZNSt15regex_constantsL13match_not_eowE, @object
.size _ZNSt15regex_constantsL13match_not_eowE, 4
_ZNSt15regex_constantsL13match_not_eowE:
.long 8
.align 4
.type _ZNSt15regex_constantsL9match_anyE, @object
.size _ZNSt15regex_constantsL9match_anyE, 4
_ZNSt15regex_constantsL9match_anyE:
.long 16
.align 4
.type _ZNSt15regex_constantsL14match_not_nullE, @object
.size _ZNSt15regex_constantsL14match_not_nullE, 4
_ZNSt15regex_constantsL14match_not_nullE:
.long 32
.align 4
.type _ZNSt15regex_constantsL16match_continuousE, @object
.size _ZNSt15regex_constantsL16match_continuousE, 4
_ZNSt15regex_constantsL16match_continuousE:
.long 64
.align 4
.type _ZNSt15regex_constantsL16match_prev_availE, @object
.size _ZNSt15regex_constantsL16match_prev_availE, 4
_ZNSt15regex_constantsL16match_prev_availE:
.long 128
.align 4
.type _ZNSt15regex_constantsL14format_defaultE, @object
.size _ZNSt15regex_constantsL14format_defaultE, 4
_ZNSt15regex_constantsL14format_defaultE:
.zero 4
.align 4
.type _ZNSt15regex_constantsL10format_sedE, @object
.size _ZNSt15regex_constantsL10format_sedE, 4
_ZNSt15regex_constantsL10format_sedE:
.long 256
.align 4
.type _ZNSt15regex_constantsL14format_no_copyE, @object
.size _ZNSt15regex_constantsL14format_no_copyE, 4
_ZNSt15regex_constantsL14format_no_copyE:
.long 512
.align 4
.type _ZNSt15regex_constantsL17format_first_onlyE, @object
.size _ZNSt15regex_constantsL17format_first_onlyE, 4
_ZNSt15regex_constantsL17format_first_onlyE:
.long 1024
.align 4
.type _ZNSt15regex_constantsL13error_collateE, @object
.size _ZNSt15regex_constantsL13error_collateE, 4
_ZNSt15regex_constantsL13error_collateE:
.zero 4
.align 4
.type _ZNSt15regex_constantsL11error_ctypeE, @object
.size _ZNSt15regex_constantsL11error_ctypeE, 4
_ZNSt15regex_constantsL11error_ctypeE:
.long 1
.align 4
.type _ZNSt15regex_constantsL12error_escapeE, @object
.size _ZNSt15regex_constantsL12error_escapeE, 4
_ZNSt15regex_constantsL12error_escapeE:
.long 2
.align 4
.type _ZNSt15regex_constantsL13error_backrefE, @object
.size _ZNSt15regex_constantsL13error_backrefE, 4
_ZNSt15regex_constantsL13error_backrefE:
.long 3
.align 4
.type _ZNSt15regex_constantsL11error_brackE, @object
.size _ZNSt15regex_constantsL11error_brackE, 4
_ZNSt15regex_constantsL11error_brackE:
.long 4
.align 4
.type _ZNSt15regex_constantsL11error_parenE, @object
.size _ZNSt15regex_constantsL11error_parenE, 4
_ZNSt15regex_constantsL11error_parenE:
.long 5
.align 4
.type _ZNSt15regex_constantsL11error_braceE, @object
.size _ZNSt15regex_constantsL11error_braceE, 4
_ZNSt15regex_constantsL11error_braceE:
.long 6
.align 4
.type _ZNSt15regex_constantsL14error_badbraceE, @object
.size _ZNSt15regex_constantsL14error_badbraceE, 4
_ZNSt15regex_constantsL14error_badbraceE:
.long 7
.align 4
.type _ZNSt15regex_constantsL11error_rangeE, @object
.size _ZNSt15regex_constantsL11error_rangeE, 4
_ZNSt15regex_constantsL11error_rangeE:
.long 8
.align 4
.type _ZNSt15regex_constantsL11error_spaceE, @object
.size _ZNSt15regex_constantsL11error_spaceE, 4
_ZNSt15regex_constantsL11error_spaceE:
.long 9
.align 4
.type _ZNSt15regex_constantsL15error_badrepeatE, @object
.size _ZNSt15regex_constantsL15error_badrepeatE, 4
_ZNSt15regex_constantsL15error_badrepeatE:
.long 10
.align 4
.type _ZNSt15regex_constantsL16error_complexityE, @object
.size _ZNSt15regex_constantsL16error_complexityE, 4
_ZNSt15regex_constantsL16error_complexityE:
.long 11
.align 4
.type _ZNSt15regex_constantsL11error_stackE, @object
.size _ZNSt15regex_constantsL11error_stackE, 4
_ZNSt15regex_constantsL11error_stackE:
.long 12
.align 8
.type _ZNSt8__detailL19_S_invalid_state_idE, @object
.size _ZNSt8__detailL19_S_invalid_state_idE, 8
_ZNSt8__detailL19_S_invalid_state_idE:
.quad -1
.align 4
.type _ZL1N, @object
.size _ZL1N, 4
_ZL1N:
.long 200050
.section .text._ZNK1v4timeEv,"axG",@progbits,_ZNK1v4timeEv,comdat
.align 2
.weak _ZNK1v4timeEv
.type _ZNK1v4timeEv, @function
_ZNK1v4timeEv:
.LFB8241:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
mov QWORD PTR -8[rbp], rdi
mov rax, QWORD PTR -8[rbp]
mov edx, DWORD PTR 4[rax]
mov rax, QWORD PTR -8[rbp]
mov eax, DWORD PTR [rax]
sub edx, eax
mov eax, edx
add eax, 1
pop rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE8241:
.size _ZNK1v4timeEv, .-_ZNK1v4timeEv
.globl a
.bss
.align 32
.type a, @object
.size a, 2400600
a:
.zero 2400600
.section .rodata
.LC0:
.string "%d%d"
.LC1:
.string "%d%d%d"
.LC2:
.string "%d"
.text
.globl main
.type main, @function
main:
.LFB8242:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
sub rsp, 32
mov rax, QWORD PTR fs:40
mov QWORD PTR -8[rbp], rax
xor eax, eax
lea rdi, a[rip]
call _ZNK1v4timeEv
mov DWORD PTR -16[rbp], eax
lea rdx, -28[rbp]
lea rax, -32[rbp]
mov rsi, rax
lea rdi, .LC0[rip]
mov eax, 0
call scanf@PLT
mov DWORD PTR -24[rbp], 0
.L5:
mov eax, DWORD PTR -32[rbp]
cmp DWORD PTR -24[rbp], eax
jge .L4
mov eax, DWORD PTR -24[rbp]
movsx rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
sal rax, 2
lea rdx, a[rip]
add rax, rdx
lea rcx, 8[rax]
mov eax, DWORD PTR -24[rbp]
movsx rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
sal rax, 2
lea rdx, a[rip]
add rax, rdx
lea rsi, 4[rax]
mov eax, DWORD PTR -24[rbp]
movsx rdx, eax
mov rax, rdx
add rax, rax
add rax, rdx
sal rax, 2
lea rdx, a[rip]
add rax, rdx
mov rdx, rsi
mov rsi, rax
lea rdi, .LC1[rip]
mov eax, 0
call scanf@PLT
add DWORD PTR -24[rbp], 1
jmp .L5
.L4:
mov DWORD PTR -12[rbp], -1
mov DWORD PTR -20[rbp], 0
.L7:
mov eax, DWORD PTR -32[rbp]
cmp DWORD PTR -20[rbp], eax
jge .L6
add DWORD PTR -20[rbp], 1
jmp .L7
.L6:
mov eax, DWORD PTR -12[rbp]
mov esi, eax
lea rdi, .LC2[rip]
mov eax, 0
call printf@PLT
mov eax, 0
mov rcx, QWORD PTR -8[rbp]
xor rcx, QWORD PTR fs:40
je .L9
call __stack_chk_fail@PLT
.L9:
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE8242:
.size main, .-main
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB9545:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
sub rsp, 16
mov DWORD PTR -4[rbp], edi
mov DWORD PTR -8[rbp], esi
cmp DWORD PTR -4[rbp], 1
jne .L12
cmp DWORD PTR -8[rbp], 65535
jne .L12
lea rdi, _ZStL8__ioinit[rip]
call _ZNSt8ios_base4InitC1Ev@PLT
lea rdx, __dso_handle[rip]
lea rsi, _ZStL8__ioinit[rip]
mov rax, QWORD PTR _ZNSt8ios_base4InitD1Ev@GOTPCREL[rip]
mov rdi, rax
call __cxa_atexit@PLT
.L12:
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE9545:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.type _GLOBAL__sub_I_a, @function
_GLOBAL__sub_I_a:
.LFB9568:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
mov esi, 65535
mov edi, 1
call _Z41__static_initialization_and_destruction_0ii
pop rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE9568:
.size _GLOBAL__sub_I_a, .-_GLOBAL__sub_I_a
.section .init_array,"aw"
.align 8
.quad _GLOBAL__sub_I_a
.hidden __dso_handle
.ident "GCC: (Ubuntu 8.2.0-7ubuntu1) 8.2.0"
.section .note.GNU-stack,"",@progbits

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
#define f first
#define s second
pair<int, int> comp[N], sock[N];
//#define nxt(x) (((~(decltype(x))0) << 1 & x) << 1)
#define nxt(x) ((x | 1) << 1)
int main()
{
for (int i = 0; i < 20; i++)
printf("%d %d\n", i, nxt(i));
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++)
scanf("%d", &comp[i].f), comp[i].s = i;
for (int i = 0; i < m; i++)
scanf("%d", &sock[i].f), sock[i].s = i;
sort(comp, comp + n);
sort(sock, sock + m);
return 0;
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,8 @@
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout << "Hello world" << endl;
int a = 0;
return 0;
}

@ -0,0 +1,7 @@
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout << "Hello world2" << endl;
return 0;
}

@ -0,0 +1,22 @@
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("1.txt", "r", stdin);
int n, k, x;
scanf("%d%d", &n, &k);
priority_queue<int> hp;
for (int i = 0; i < n; i++)
scanf("%d", &x), hp.push(x);
while (k--)
{
x = hp.top();
hp.pop();
hp.push(x >> 1);
}
long long ans = 0;
for (int i = 0; i < n; i++)
ans += hp.top(), hp.pop();
printf("%lld", ans);
return 0;
}

@ -0,0 +1,5 @@
import random
with open("1.txt", "w") as f:
f.write("100000 1000000000\n")
for i in range(10**5):
f.write(str(random.randint(1, 10**9)) + " ")

@ -0,0 +1,69 @@
#include <bits/stdc++.h>
using namespace std;
typedef struct Point
{
double x, y;
double operator*(const Point &b)
{
return x * b.x + y * b.y;
}
double operator^(const Point &b)
{
return x * b.y - y * b.x;
}
} point, vec;
//vec operator-(const vec &lhs, const vec &rhs) { return {lhs.x - rhs.x, lhs.y - rhs.y}; }
point operator-(const point &lhs, const point &rhs) { return {lhs.x - rhs.x, lhs.y - rhs.y}; }
const double eps = 1e-6;
int sgn(double x)
{
if (x < -eps)
return -1;
if (x > eps)
return 1;
return 0;
}
point p[1010];
struct Edge
{
int f, t;
} e[2020];
bool SegmentCross(point a1, point a2, point b1, point b2)
{
double c1 = sgn((a2 - a1) ^ (b1 - a1));
double c2 = sgn((a2 - a1) ^ (b2 - a1));
double c3 = sgn((b2 - b1) ^ (a1 - b1));
double c4 = sgn((b2 - b1) ^ (a2 - b1));
//正规相交
if (c1 * c2 < 0 && c3 * c4 < 0)
return 1;
return 0;
return (c1 == 0 && sgn((a1 - b1) * (a2 - b1)) <= 0) ||
(c2 == 0 && sgn((a1 - b2) * (a2 - b2)) <= 0) ||
(c3 == 0 && sgn((b1 - a1) * (b2 - a1)) <= 0) ||
(c4 == 0 && sgn((b1 - a2) * (b2 - a2)) <= 0);
}
bool inters(const Edge &lhs, const Edge &rhs)
{
point p1 = p[lhs.f], p2 = p[lhs.t], p3 = p[rhs.f], p4 = p[rhs.t];
return SegmentCross(p1, p2, p3, p4);
//vec l1 = p2 - p1, l2 = p4 - p3;
}
int main()
{
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++)
scanf("%d%d", &e[i].f, &e[i].t);
for (int i = 0; i < n; i++)
scanf("%lf%lf", &p[i].x, &p[i].y);
int ans = 0;
for (int i = 0; i < m; i++)
for (int j = i + 1; j < m; j++)
if (inters(e[i], e[j]))
ans++;
printf("%d", ans);
return 0;
}
Loading…
Cancel
Save