Changes
11 changed files (+191/-191)
-
-
@@ -1,8 +1,8 @@* !*/ !*.* .vscode *.in *.out *.ans *.exe * !*/ !*.* .vscode *.in *.out *.ans *.exe
-
-
-
@@ -1,5 +1,5 @@{ "files.associations": { "iosfwd": "cpp" } { "files.associations": { "iosfwd": "cpp" } }
-
-
-
@@ -1,3 +1,3 @@# USACO-Demo The solutions here are for the USACO 2019 December Contest, Bronze. # USACO-Demo The solutions here are for the USACO 2019 December Contest, Bronze.
-
-
-
@@ -1,34 +1,34 @@#include <bits/stdc++.h> using namespace std; int main() { ifstream cin("gymnastics.in"); ofstream cout("gymnastics.out"); int K, N; cin >> K >> N; int rnk[11][22]; for (int i = 1; i <= K; ++i) { for (int j = 1; j <= N; ++j) { int cow; cin >> cow; rnk[i][cow] = j; } } int ans = 0; for (int a = 1; a <= N; ++a) { for (int b = 1; b <= N; ++b) { if (a == b) continue; bool better = true; for (int i = 1; i <= K; ++i) { if (rnk[i][a] > rnk[i][b]) better = false; } if (better) ++ans; } } cout << ans; #include <bits/stdc++.h> using namespace std; int main() { ifstream cin("gymnastics.in"); ofstream cout("gymnastics.out"); int K, N; cin >> K >> N; int rnk[11][22]; for (int i = 1; i <= K; ++i) { for (int j = 1; j <= N; ++j) { int cow; cin >> cow; rnk[i][cow] = j; } } int ans = 0; for (int a = 1; a <= N; ++a) { for (int b = 1; b <= N; ++b) { if (a == b) continue; bool better = true; for (int i = 1; i <= K; ++i) { if (rnk[i][a] > rnk[i][b]) better = false; } if (better) ++ans; } } cout << ans; }
-
-
-
@@ -1,6 +1,6 @@#include <bits/stdc++.h> using namespace std; int main() { #include <bits/stdc++.h> using namespace std; int main() { }
-
-
-
@@ -1,3 +1,3 @@public class lineup { public class lineup { }
-
-
-
@@ -1,14 +1,14 @@read in N constraints[N][2] for i from 1 to N: read in constraints[i][1] and constraints[i][2] for every permutation P of [ Bessie, Buttercup, Belinda, Beatrice, Bella, Blue, Betsy, Sue ]: for i from 1 to N: bad = false if the position of constraints[i][1] is NOT next to position of constraints[i][2] then set bad to true if NOT bad read in N constraints[N][2] for i from 1 to N: read in constraints[i][1] and constraints[i][2] for every permutation P of [ Bessie, Buttercup, Belinda, Beatrice, Bella, Blue, Betsy, Sue ]: for i from 1 to N: bad = false if the position of constraints[i][1] is NOT next to position of constraints[i][2] then set bad to true if NOT bad then output P
-
-
-
@@ -1,36 +1,36 @@with open("photo.in", "r") as fin: L = list(fin) N = int(L[0]) b = [] for bi in L[1].split(): b.append(int(bi)) for start in range(1, N + 1): # N a = [ start ] for i in range(0, N - 1): # N a.append(b[i] - a[i]) valid = True appeared = {} for i in range(0, N): appeared[a[i]] = False for i in range(0, N): if a[i] < 1: valid = False elif a[i] > N: valid = False elif appeared[a[i]] == True: valid = False appeared[a[i]] = True if valid == True: with open("photo.out", "w") as fout: firstLine = True for ai in a: if firstLine == True: firstLine = False else: fout.write(" ") fout.write(str(ai)) exit() with open("photo.in", "r") as fin: L = list(fin) N = int(L[0]) b = [] for bi in L[1].split(): b.append(int(bi)) for start in range(1, N + 1): # N a = [ start ] for i in range(0, N - 1): # N a.append(b[i] - a[i]) valid = True appeared = {} for i in range(0, N): appeared[a[i]] = False for i in range(0, N): if a[i] < 1: valid = False elif a[i] > N: valid = False elif appeared[a[i]] == True: valid = False appeared[a[i]] = True if valid == True: with open("photo.out", "w") as fout: firstLine = True for ai in a: if firstLine == True: firstLine = False else: fout.write(" ") fout.write(str(ai)) exit()
-
-
-
@@ -1,40 +1,40 @@with open("triangles.in", "r") as fin: L = list(fin) N = int(L[0]) X = [] Y = [] for i in range(1, N + 1): x, y = map(int, L[i].split()) X.append(x) Y.append(y) ans = 0 for i in range(0, N): for j in range(i + 1, N): for k in range(j + 1, N): base = 0 height = 0 if X[i] == X[j]: height = abs(Y[j] - Y[i]) elif X[j] == X[k]: height = abs(Y[k] - Y[j]) elif X[k] == X[i]: height = abs(Y[i] - Y[k]) else: continue if Y[i] == Y[j]: base = abs(X[j] - X[i]) elif Y[j] == Y[k]: base = abs(X[k] - X[j]) elif Y[k] == Y[i]: base = abs(X[i] - X[k]) else: continue if base*height > ans: ans = base*height with open("triangles.out", "w") as fout: fout.write(str(ans)) with open("triangles.in", "r") as fin: L = list(fin) N = int(L[0]) X = [] Y = [] for i in range(1, N + 1): x, y = map(int, L[i].split()) X.append(x) Y.append(y) ans = 0 for i in range(0, N): for j in range(i + 1, N): for k in range(j + 1, N): base = 0 height = 0 if X[i] == X[j]: height = abs(Y[j] - Y[i]) elif X[j] == X[k]: height = abs(Y[k] - Y[j]) elif X[k] == X[i]: height = abs(Y[i] - Y[k]) else: continue if Y[i] == Y[j]: base = abs(X[j] - X[i]) elif Y[j] == Y[k]: base = abs(X[k] - X[j]) elif Y[k] == Y[i]: base = abs(X[i] - X[k]) else: continue if base*height > ans: ans = base*height with open("triangles.out", "w") as fout: fout.write(str(ans))
-
-
-
@@ -1,34 +1,34 @@#include <bits/stdc++.h> using namespace std; int main() { ifstream cin("whereami.in"); ofstream cout("whereami.out"); int N; cin >> N; string S; cin >> S; for (int K = 1; K <= N; ++K) { bool good = true; for (int a = 0; a <= N - K; ++a) { for (int b = 0; b <= N - K; ++b) { if (a == b) continue; bool string_equal = true; for (int i = 0; i <= K - 1; ++i) { if (S[a + i] != S[b + i]) string_equal = false; } if (string_equal) good = false; } } if (good) { cout << K; return 0; } } #include <bits/stdc++.h> using namespace std; int main() { ifstream cin("whereami.in"); ofstream cout("whereami.out"); int N; cin >> N; string S; cin >> S; for (int K = 1; K <= N; ++K) { bool good = true; for (int a = 0; a <= N - K; ++a) { for (int b = 0; b <= N - K; ++b) { if (a == b) continue; bool string_equal = true; for (int i = 0; i <= K - 1; ++i) { if (S[a + i] != S[b + i]) string_equal = false; } if (string_equal) good = false; } } if (good) { cout << K; return 0; } } }
-
-
-
@@ -1,15 +1,15 @@with open("word.in", "r") as fin: L = list(fin) N, K = map(int, L[0].split()) # "10" "7" with open("word.out", "w") as fout: curLen = 0 # current length of line for word in L[1].split(): # go through each word if curLen + len(word) > K: # place on new line fout.write("\n") fout.write(word) curLen = len(word) else: # place on current line if curLen > 0: fout.write(" ") fout.write(word) with open("word.in", "r") as fin: L = list(fin) N, K = map(int, L[0].split()) # "10" "7" with open("word.out", "w") as fout: curLen = 0 # current length of line for word in L[1].split(): # go through each word if curLen + len(word) > K: # place on new line fout.write("\n") fout.write(word) curLen = len(word) else: # place on current line if curLen > 0: fout.write(" ") fout.write(word) curLen += len(word)
-