Submission #335088

# Submission time Handle Problem Language Result Execution time Memory
335088 2020-12-11T06:15:32 Z nicholask Strange Device (APIO19_strange_device) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;
signed main(){
	int n,a,b;
	cin>>n>>a>>b;
	pair <int,int> a[n];
	for (int i=0; i<n; i++) cin>>a[i].first>>a[i].second;
	if (n==1){
		cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
	} else {
		set <pair <int,int> > s;
		for (int i=0; i<n; i++){
			for (int t=u; t<=v; t++) s.insert({(t+t/b)%a,t%b});
		}
		cout<<s.size();
	}
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:7:17: error: conflicting declaration 'std::pair<long long unsigned int, long long unsigned int> a [n]'
    7 |  pair <int,int> a[n];
      |                 ^
strange_device.cpp:5:8: note: previous declaration as 'long long unsigned int a'
    5 |  int n,a,b;
      |        ^
strange_device.cpp:8:34: error: invalid types 'long long unsigned int[long long unsigned int]' for array subscript
    8 |  for (int i=0; i<n; i++) cin>>a[i].first>>a[i].second;
      |                                  ^
strange_device.cpp:8:46: error: invalid types 'long long unsigned int[long long unsigned int]' for array subscript
    8 |  for (int i=0; i<n; i++) cin>>a[i].first>>a[i].second;
      |                                              ^
strange_device.cpp:10:16: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                ^
strange_device.cpp:10:28: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                            ^
strange_device.cpp:10:41: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                                         ^
strange_device.cpp:10:52: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                                                    ^
strange_device.cpp:10:70: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                                                                      ^
strange_device.cpp:10:83: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                                                                                   ^
strange_device.cpp:10:98: error: invalid types 'long long unsigned int[int]' for array subscript
   10 |   cout<<min(a[0].second-a[0].first+1,a[0].first*a[0].second/__gcd(a[0].second,(a[0].second+1)%a[0].first));
      |                                                                                                  ^
strange_device.cpp:14:15: error: 'u' was not declared in this scope
   14 |    for (int t=u; t<=v; t++) s.insert({(t+t/b)%a,t%b});
      |               ^
strange_device.cpp:14:21: error: 'v' was not declared in this scope
   14 |    for (int t=u; t<=v; t++) s.insert({(t+t/b)%a,t%b});
      |                     ^