Submission #541294

#TimeUsernameProblemLanguageResultExecution timeMemory
541294AlesL0Mutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int n; int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1]; void init(string a, string b){ n = a.size(); //a1.resize(n+1); a2.resize(n+1); t1.resize(n+1); t2.resize(n+1); c1.resize(n+1); c2.resize(n+1); f.resize(n+1); a1[0] = 0; a2[0] = 0; t1[0] = 0; t2[0] = 0; c1[0] = 0; c2[0] = 0; f[0] = 0; for (int i = 0; i < n; i++){ a1[i+1] = a1[i]; a2[i+1] = a2[i]; t1[i+1] = t1[i]; t2[i+1] = t2[i]; c1[i+1] = c1[i]; c2[i+1] = c2[i]; f[i+1] = f[i]; if (a[i] == 'A')a1[i+1]++; else if (a[i] == 'T')t1[i+1]++; else c1[i+1]++; if (b[i] == 'A')a2[i+1]++; else if (b[i] == 'T')t2[i+1]++; else c2[i+1]++; if (a[i] != b[i])f[i+1]++; } } int get_distance(int x, int y){ if (((a1[y+1]-a1[x])==(a2[y+1]-a2[x])) && ((t1[y+1]-t1[x])==(t2[y+1]-t2[x])) && ((c1[y+1]-c1[x])==(c2[y+1]-c2[x]))){ int h = f[y+1]-f[x]; return ((h+h%2)/2); } else return -1; }

Compilation message (stderr)

dna.cpp:6:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |        ~~~^~
dna.cpp:6:11: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:11: error: size of array 'a1' has non-integral type 'double'
dna.cpp:6:22: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |                   ~~~^~
dna.cpp:6:22: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:22: error: size of array 'a2' has non-integral type 'double'
dna.cpp:6:33: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |                              ~~~^~
dna.cpp:6:33: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:33: error: size of array 't1' has non-integral type 'double'
dna.cpp:6:44: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |                                         ~~~^~
dna.cpp:6:44: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:44: error: size of array 't2' has non-integral type 'double'
dna.cpp:6:55: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |                                                    ~~~^~
dna.cpp:6:55: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:55: error: size of array 'c1' has non-integral type 'double'
dna.cpp:6:66: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |                                                               ~~~^~
dna.cpp:6:66: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:66: error: size of array 'c2' has non-integral type 'double'
dna.cpp:6:76: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int a1[1e5+1], a2[1e5+1], t1[1e5+1], t2[1e5+1], c1[1e5+1], c2[1e5+1], f[1e5+1];
      |                                                                         ~~~^~
dna.cpp:6:76: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
dna.cpp:6:76: error: size of array 'f' has non-integral type 'double'