제출 #741571

#제출 시각아이디문제언어결과실행 시간메모리
741571yeyso이상한 기계 (APIO19_strange_device)C++14
0 / 100
3138 ms524288 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, a, b; cin >> n >> a >> b;
    vector<pair<int, int>> periods;
    int l, r;
    int time = 0;
    for(int i = 0; i < n; i ++){
        cin >> l >> r;
        periods.push_back({l, r});
    }
    time = periods[periods.size()-1].second;
    set<pair<int, int>> res;
    int x, y;
    for(int i = 0; i < n; i ++){
        for(int t = periods[i].first; t <= periods[i].second; t ++){
            x = (t + (t/b)) % a;
            y = t % b;
            res.insert({x, y});
        }
    }
    cout << res.size();
}
/*
g++ -std=gnu++17 -O2 -pipe -static -o device device.cpp
3 3 3
4 4
7 9
17 18
*/

컴파일 시 표준 에러 (stderr) 메시지

strange_device.cpp: In function 'int main()':
strange_device.cpp:7:9: warning: variable 'time' set but not used [-Wunused-but-set-variable]
    7 |     int time = 0;
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...