답안 #1068725

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068725 2024-08-21T11:33:12 Z alexdd 이상한 기계 (APIO19_strange_device) C++17
10 / 100
5000 ms 524288 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int x, int y)
{
    while(x>0)
    {
        int r = y%x;
        y=x;
        x=r;
    }
    return y;
}
map<pair<int,int>,int> mp;
signed main()
{
    int n,A,B,cnt=0,B1;
    cin>>n>>A>>B;
    int gc = gcd(A,B+1);
    A /= gc;
    B1 = (B+1)/gc;
    int le,ri;
    for(int i=1;i<=n;i++)
    {
        cin>>le>>ri;
        for(int t=le;t<=ri;t++)
        {
            int p = t/B;
            pair<int,int> aux = {p%A, t%B};
            if(mp[aux]==0)
            {
                mp[aux]++;
                cnt++;
            }
        }
    }
    cout<<cnt;
    return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:17:21: warning: variable 'B1' set but not used [-Wunused-but-set-variable]
   17 |     int n,A,B,cnt=0,B1;
      |                     ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 53 ms 12372 KB Output is correct
3 Correct 82 ms 18004 KB Output is correct
4 Correct 2 ms 856 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 6 ms 1196 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 34 ms 7112 KB Output is correct
16 Correct 37 ms 6992 KB Output is correct
17 Correct 120 ms 6484 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 3584 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 137 ms 32396 KB Output is correct
3 Correct 122 ms 31976 KB Output is correct
4 Correct 125 ms 30548 KB Output is correct
5 Execution timed out 5007 ms 62592 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1072 ms 62776 KB Output is correct
3 Runtime error 2039 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1072 ms 62776 KB Output is correct
3 Runtime error 2039 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1072 ms 62776 KB Output is correct
3 Runtime error 2039 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 2352 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 53 ms 12372 KB Output is correct
3 Correct 82 ms 18004 KB Output is correct
4 Correct 2 ms 856 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 6 ms 1196 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 34 ms 7112 KB Output is correct
16 Correct 37 ms 6992 KB Output is correct
17 Correct 120 ms 6484 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Runtime error 3584 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -