답안 #1040921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040921 2024-08-01T12:18:27 Z Andrey 마술쇼 (APIO24_show) C++17
100 / 100
2 ms 832 KB
#include "Alice.h"
#include<bits/stdc++.h>
using namespace std;


std::vector<std::pair<int,int>> Alice(){
    long long x = setN(5000);
    vector<pair<int,int>> haha(0);
    for(int i = 2; i <= 5000; i++) {
        haha.push_back({x%(i-1)+1,i});
    }
    return haha;
}
#include "Bob.h"
#include<bits/stdc++.h>
using namespace std;

long long gcd(long long a, long long b) {
    if(b == 0) {
        return a;
    }
    return gcd(b,a%b);
}

long long lcm(long long a, long long b) {
    return (a/gcd(a,b))*b;
}

long long Bob(std::vector<std::pair<int,int>> haha){
	long long c = 1,ost = 0;
    for(int i = 0; i < haha.size(); i++) {
        int a = haha[i].first,b = haha[i].second;
        if(a > b) {
            swap(a,b);
        }
        while(ost%(b-1) != a-1) {
            ost+=c;
        }
        c = lcm(c,b-1);
    }
    if(ost == 0) {
        return c;
    }
    else {
        return ost;
    }
}

Compilation message

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 0; i < haha.size(); i++) {
      |                    ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 820 KB Correct.
2 Correct 1 ms 832 KB Correct.
3 Correct 1 ms 820 KB Correct.
4 Correct 2 ms 816 KB Correct.
5 Correct 2 ms 816 KB Correct.
6 Correct 1 ms 820 KB Correct.
7 Correct 2 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 820 KB Correct.
10 Correct 1 ms 832 KB Correct.
11 Correct 2 ms 832 KB Correct.
12 Correct 2 ms 816 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 820 KB Correct.
2 Correct 1 ms 832 KB Correct.
3 Correct 1 ms 820 KB Correct.
4 Correct 2 ms 816 KB Correct.
5 Correct 2 ms 816 KB Correct.
6 Correct 1 ms 820 KB Correct.
7 Correct 2 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 820 KB Correct.
10 Correct 1 ms 832 KB Correct.
11 Correct 2 ms 832 KB Correct.
12 Correct 2 ms 816 KB Correct.
13 Correct 1 ms 820 KB Correct.
14 Correct 1 ms 820 KB Correct.
15 Correct 1 ms 820 KB Correct.
16 Correct 1 ms 832 KB Correct.
17 Correct 1 ms 816 KB Correct.
18 Correct 1 ms 832 KB Correct.
19 Correct 2 ms 820 KB Correct.
20 Correct 1 ms 820 KB Correct.
21 Correct 1 ms 820 KB Correct.
22 Correct 1 ms 820 KB Correct.
23 Correct 1 ms 820 KB Correct.
24 Correct 1 ms 820 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 820 KB Correct.
2 Correct 1 ms 832 KB Correct.
3 Correct 1 ms 820 KB Correct.
4 Correct 2 ms 816 KB Correct.
5 Correct 2 ms 816 KB Correct.
6 Correct 1 ms 820 KB Correct.
7 Correct 2 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 820 KB Correct.
10 Correct 1 ms 832 KB Correct.
11 Correct 2 ms 832 KB Correct.
12 Correct 2 ms 816 KB Correct.
13 Correct 1 ms 820 KB Correct.
14 Correct 1 ms 820 KB Correct.
15 Correct 1 ms 820 KB Correct.
16 Correct 1 ms 832 KB Correct.
17 Correct 1 ms 816 KB Correct.
18 Correct 1 ms 832 KB Correct.
19 Correct 2 ms 820 KB Correct.
20 Correct 1 ms 820 KB Correct.
21 Correct 1 ms 820 KB Correct.
22 Correct 1 ms 820 KB Correct.
23 Correct 1 ms 820 KB Correct.
24 Correct 1 ms 820 KB Correct.
25 Correct 1 ms 820 KB Correct.
26 Correct 1 ms 820 KB Correct.
27 Correct 2 ms 820 KB Correct.
28 Correct 1 ms 832 KB Correct.
29 Correct 1 ms 816 KB Correct.
30 Correct 1 ms 820 KB Correct.
31 Correct 2 ms 820 KB Correct.
32 Correct 1 ms 820 KB Correct.
33 Correct 1 ms 820 KB Correct.
34 Correct 2 ms 820 KB Correct.
35 Correct 1 ms 820 KB Correct.
36 Correct 1 ms 824 KB Correct.
37 Correct 1 ms 824 KB Correct.
38 Correct 1 ms 832 KB Correct.
39 Correct 1 ms 820 KB Correct.
40 Correct 1 ms 824 KB Correct.
41 Correct 1 ms 820 KB Correct.
42 Correct 1 ms 820 KB Correct.
43 Correct 1 ms 820 KB Correct.
44 Correct 1 ms 820 KB Correct.