#ifndef STRUCT07_H_
#define STRUCT07_H_
#include <iostream>
using namespace std;
struct complex_number {
double real;
double imaginary;
};
istream& operator>>(istream& is, complex_number& cpx);
enum complex_type{
real,
imaginary
};
struct Query{
complex_type type;
int index;
};
class Judge{
public:
void check_init(){
if(init == 0){
cout << "Please call the init function first!" << endl;
exit(0);
}
}
void init_f(int &N, int &Q, complex_number*& cpx, Query*& queries){
cin >> N >> Q;
cpx = new complex_number[N];
queries = new Query[Q];
for(int i = 0; i < N; i++){
cin >> cpx[i];
}
for(int i = 0; i < Q; i++){
int tp;
cin >> queries[i].index >> tp;
if(tp) queries[i].type = imaginary;
else queries[i].type = real;
}
init = 1;
}
private:
int init = 0;
};
Judge j;
void Init(int &N, int &Q, complex_number*& cpx, Query*& queries){
j.init_f(N, Q, cpx, queries);
}
void Answer(double ans){
j.check_init();
cout << ans << endl;
}
#endif // STRUCT07_H_
I2lmbmRlZiBTVFJVQ1QwN19IXwojZGVmaW5lIFNUUlVDVDA3X0hfCgojaW5jbHVkZSA8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgY29tcGxleF9udW1iZXIgewogICAgZG91YmxlIHJlYWw7CiAgICBkb3VibGUgaW1hZ2luYXJ5Owp9OwoKaXN0cmVhbSYgb3BlcmF0b3I+Pihpc3RyZWFtJiBpcywgY29tcGxleF9udW1iZXImIGNweCk7CgplbnVtIGNvbXBsZXhfdHlwZXsKICAgIHJlYWwsCiAgICBpbWFnaW5hcnkKfTsKCnN0cnVjdCBRdWVyeXsKICAgIGNvbXBsZXhfdHlwZSB0eXBlOwogICAgaW50IGluZGV4Owp9OwoKY2xhc3MgSnVkZ2V7CiAgICBwdWJsaWM6CiAgICAgICAgdm9pZCBjaGVja19pbml0KCl7CiAgICAgICAgICAgIGlmKGluaXQgPT0gMCl7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICJQbGVhc2UgY2FsbCB0aGUgaW5pdCBmdW5jdGlvbiBmaXJzdCEiIDw8IGVuZGw7CiAgICAgICAgICAgICAgICBleGl0KDApOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHZvaWQgaW5pdF9mKGludCAmTiwgaW50ICZRLCBjb21wbGV4X251bWJlciomIGNweCwgUXVlcnkqJiBxdWVyaWVzKXsKICAgICAgICAgICAgY2luID4+IE4gPj4gUTsKICAgICAgICAgICAgY3B4ID0gbmV3IGNvbXBsZXhfbnVtYmVyW05dOwogICAgICAgICAgICBxdWVyaWVzID0gbmV3IFF1ZXJ5W1FdOwogICAgICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgTjsgaSsrKXsKICAgICAgICAgICAgICAgIGNpbiA+PiBjcHhbaV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IFE7IGkrKyl7CiAgICAgICAgICAgICAgICBpbnQgdHA7CiAgICAgICAgICAgICAgICBjaW4gPj4gcXVlcmllc1tpXS5pbmRleCA+PiB0cDsKICAgICAgICAgICAgICAgIGlmKHRwKSBxdWVyaWVzW2ldLnR5cGUgPSBpbWFnaW5hcnk7CiAgICAgICAgICAgICAgICBlbHNlIHF1ZXJpZXNbaV0udHlwZSA9IHJlYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW5pdCA9IDE7CiAgICAgICAgfQogICAgcHJpdmF0ZToKICAgICAgICBpbnQgaW5pdCA9IDA7Cn07CgpKdWRnZSBqOwoKdm9pZCBJbml0KGludCAmTiwgaW50ICZRLCBjb21wbGV4X251bWJlciomIGNweCwgUXVlcnkqJiBxdWVyaWVzKXsKICAgIGouaW5pdF9mKE4sIFEsIGNweCwgcXVlcmllcyk7Cn0KCnZvaWQgQW5zd2VyKGRvdWJsZSBhbnMpewogICAgai5jaGVja19pbml0KCk7CiAgICBjb3V0IDw8IGFucyA8PCBlbmRsOwp9CiNlbmRpZiAvLyBTVFJVQ1QwN19IXwo=