Tue, 02 Apr 2019 19:56:45 GMT

master
大蒟蒻 7 years ago
parent 7a03e71fa1
commit f5ee9f7012

@ -4,4 +4,5 @@ add_executable(B B.cpp)
add_executable(C C.cpp)
add_executable(D D.cpp)
add_executable(E E.cpp)
add_executable(J J.cpp)
add_executable(J J.cpp)
add_executable(I I.cpp)

@ -0,0 +1,20 @@
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int T;
ll n, k;
scanf("%d", &T);
while (T--)
{
scanf("%lld%lld", &n, &k);
if (k == 1)
printf("%lld\n", array<ll, 4>({n, 1, n + 1, 0})[n & 3]);
else
{
}
}
return 0;
}

@ -0,0 +1,3 @@
set(CMAKE_CXX_STANDARD 17)
add_executable(D D.cpp)
add_executable(E E.cpp)

@ -0,0 +1,45 @@
#include <cstdio>
#include <cstring>
using namespace std;
char buf[7][30];
char strs[4][50];
char nums[][30] = {".XX.XX.X.....XX.....X.XX.XX.",
"......................XX.XX.",
"....XX.X..X..XX..X..X.XX....",
".......X..X..XX..X..X.XX.XX.",
".XX.......X......X....XX.XX.",
".XX....X..X..XX..X..X....XX.",
".XX.XX.X..X..XX..X..X....XX.",
".......X......X.......XX.XX.",
".XX.XX.X..X..XX..X..X.XX.XX.",
".XX....X..X..XX..X..X.XX.XX."};
int det(char *s)
{
for (int i = 0; i < 10; i++)
if (memcmp(s, nums[i], 28) == 0) return i;
return -1;
}
int main()
{
int T;
scanf("%d", &T);
while (T--)
{
for (int i = 0; i < 7; i++)
scanf("%s", buf + i);
for (int i = 0; i < 4; i++)
for (int j = 0; j < 7; j++)
strs[0][i * 7 + j] = buf[j][i];
for (int i = 0; i < 4; i++)
for (int j = 0; j < 7; j++)
strs[1][i * 7 + j] = buf[j][i + 5];
for (int i = 0; i < 4; i++)
for (int j = 0; j < 7; j++)
strs[2][i * 7 + j] = buf[j][i + 12];
for (int i = 0; i < 4; i++)
for (int j = 0; j < 7; j++)
strs[3][i * 7 + j] = buf[j][i + 17];
printf("%d%d:%d%d\n", det(strs[0]), det(strs[1]), det(strs[2]), det(strs[3]));
}
return 0;
}

@ -0,0 +1,19 @@
#include <cstdio>
using namespace std;
typedef unsigned long long ll;
ll mod = 1e9 + 7;
ll qpow(ll a, ll b)
{
ll ans = 1;
for (; b; b >>= 1, a = a * a % mod)
if (b & 1)
ans = ans * a % mod;
return ans;
}
int main()
{
ll n, k, t = 0;
while (~scanf("%llu%llu", &n, &k))
printf("Case #%llu: %llu\n", ++t, qpow(n%mod, k));
return 0;
}

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
add_compile_options("/Zc:__cplusplus")
endif()
add_executable(P2756 P2756.cpp)
add_executable(P4016 P4016.cpp)
add_executable(P4011 P4011.cpp)
add_executable(P2765 P2765.cpp)
add_executable(P4009 P4009.cpp)
add_executable(P3254 P3254.cpp)
add_executable(P2763 P2763.cpp)
add_executable(P2764 P2764.cpp)
add_executable(P4014 P4014.cpp)
add_executable(P2762 P2762.cpp)
add_executable(P4015 P4015.cpp)
add_executable(P2774 P2774.cpp)
add_executable(P2766 P2766.cpp)
add_executable(P3358 P3358.cpp)
add_executable(P3357 P3357.cpp)
add_executable(P4012 P4012.cpp)
add_executable(P3355 P3355.cpp)
add_executable(P1251 P1251.cpp)
add_executable(P3356 P3356.cpp)
add_executable(P4013 P4013.cpp)
add_executable(P2770 P2770.cpp)
add_executable(P2754 P2754.cpp)
add_executable(P2775 P2775.cpp)

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,81 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 2050, inf = 0x3f3f3f3f;
int adj[N], nxt[N << 1], to[N << 1], cap[N << 1], cur[N], cnt[N], dis[N], fa[N], ecnt;
inline void addEdge_impl_(int f, int t, int c)
{
nxt[ecnt] = adj[f];
adj[f] = ecnt;
to[ecnt] = t;
cap[ecnt] = c;
ecnt++;
}
inline void addEdge(int f, int t, int c)
{
addEdge_impl_(f, t, c);
addEdge_impl_(t, f, 0);
}
int ISAP(int S, int T)
{
int flow = 0;
for (int &di : dis) di = N - 1;
int len = 0, x;
static int que[N];
dis[que[len++] = T] = 0;
for (int i = 0; i < len; i++)
for (int e = adj[x = que[i]]; ~e; e = nxt[e])
if (cap[e ^ 1] && dis[to[e]] > dis[x] + 1)
dis[que[len++] = to[e]] = dis[x] + 1;
memset(cnt, 0, sizeof(cnt));
for (int i = 0; i < N; i++) cur[i] = adj[i], cnt[dis[i]]++;
x = S;
while (dis[S] < N - 1)
{
if (x == T)
{
int curFlow = inf;
for (x = T; x != S; x = to[fa[x] ^ 1]) curFlow = min(curFlow, cap[fa[x]]);
for (x = T; x != S; x = to[fa[x] ^ 1]) cap[fa[x]] -= curFlow, cap[fa[x] ^ 1] += curFlow;
flow += curFlow, x = S;
}
bool needRetreat = true;
for (int e = cur[x]; needRetreat && ~e; e = nxt[e])
if (cur[x] = e, cap[e] && dis[x] == dis[to[e]] + 1)
needRetreat = false, fa[x = to[e]] = e;
if (needRetreat)
{
int nd = N - 2;
for (int e = adj[x]; ~e; e = nxt[e])
if (cap[e]) nd = min(nd, dis[to[e]]);
if (--cnt[dis[x]] == 0) break;
++cnt[dis[x] = nd + 1];
cur[x] = adj[x];
if (x != S) x = to[fa[x] ^ 1];
}
}
return flow;
}
int main()
{
memset(adj, -1, sizeof(adj)), ecnt = 0;
int n, m;
scanf("%d%d", &m, &n);
for (int i, j; scanf("%d%d", &i, &j), ~(i & j);)
addEdge(i, j, 1);
for (int i = 1; i <= m; i++) addEdge(0, i, 1);
for (int j = m + 1; j <= n; j++) addEdge(j, n + 1, 1);
int flow = ISAP(0, n + 1);
if (flow)
{
printf("%d\n", flow);
for (int f = 1; f <= m; f++)
for (int e = adj[f]; ~e; e = nxt[e])
if (cap[e ^ 1] && m < to[e] && to[e] <= n)
printf("%d %d\n", f, to[e]);
}
else
puts("No Solution!");
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}
Loading…
Cancel
Save