전체 글93 Floyd-Warshall #include #include #define INF 1e9 #define NODES 101 using namespace std; int N, M; // 노드 간선 수 int dist[NODES][NODES]; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cin >> N >> M; for (int i = 1; i > v >> w; dist[u][v] = min(dist[u][v], w); } for (int k = 1; k 2020. 8. 15. Educational Codeforces Round 93 (Rated for Div. 2) AB from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): L=int(input()) s=list(map(int,input().split())) if s[0]+s[1]>s[-1]: print(-1) else: print(1,2,L) A - Bad Triangle 입력이 오름차순이므로 1, 2번과 마지막번만 비교하면 된다. from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): s=input().split("0") for i in range(len(s)): s[i]=len(.. 2020. 8. 15. Codeforces Round #664 (Div. 2) AB #include #include #include #include #include using namespace std; int T; int r, g, b, w; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cin >> T; while (T--) { cin >> r >> g >> b >> w; int r_, g_, b_, w_; r_ = r % 2; g_ = g % 2; b_ = b % 2; w_ = w % 2; if (r == 0 || g == 0 || b == 0) { if (r_ + g_ + b_ + w_ == 3 || r_ + g_ + b_ + w_ == 2) cout c; prnt(); visit[r][c] = true; to_tl.. 2020. 8. 13. KMP from sys import stdin def input(): return stdin.readline().rstrip() def getFail(P): Plen=len(P) ret=[0]*Plen j=0 for i in range(1,Plen): while j>0 and P[i]!=P[j]: j=ret[j-1] if P[i]==P[j]: j+=1 ret[i]=j return ret def KMP(T, P): ret=[] Tlen=len(T) Plen=len(P) j=0 for i in range(Tlen): while j>0 and T[i]!=P[j]: j=fail[j-1] if T[i]==P[j]: if j==Plen-1: ret.append(str(i-Plen+2)) j=fail[j] else: j+=.. 2020. 8. 11. Codeforces Round #663 (Div. 2) ABC from sys import stdin def input(): return stdin.readline().rstrip() for i in range(int(input())): n=int(input()) for _ in range(1,n+1): print(_,end=" ") print() A - Suborrays 0분에 제출한 사람이 너무 많아서 단순히 n까지 출력하는 도박을 했고 AC를 받았다. from sys import stdin def input(): return stdin.readline().rstrip() T=int(input()) for i in range(T): res=0 r,c=map(int,input().split()) for j in range(r): line=input() if j==.. 2020. 8. 10. Codeforces Round #662 (Div. 2) ABC from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): n=int(input()) print(1+n//2) A - Rainbow Dash, Fluttershy and Chess Coloring 직접 시뮬레이션 해 보면 1 - 2 - 2 - 3 - 3 - 4 - 4 - ... 순으로 답이 됨을 알 수 있다. #include #include #include #include #include using namespace std; int n, q; map plank; char oper; int target; int main() { ios::sync_with_stdio(0); cin.tie(0);.. 2020. 8. 8. 이전 1 ··· 11 12 13 14 15 16 다음