ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1313. К вопросу о спорте

Acces Violation test #4 and after that get WA #4, C++. Anyone can help me? still stuck test #4
Послано VNeo 15 июл 2017 10:56
first i get acces violation in my code. and then i search what it acces violation, and then i remake my code, then submit again. still get WA #4, before i reamke the code it says Accces Violation in test #4. Can anybody help me?

This is my code.

#include <iostream>
using namespace std;

int n,ar[10000],p;

int main(){
    cin>>n;
    for (int i=1;i<=n*n;i++){
        cin>>p;
        ar[p]=p;
    }
    for (int i=1;i<=n*n;i++){cout<<ar[i]<<' ';}
}

Edited by author 15.07.2017 10:58
Re: Acces Violation test #4 and after that get WA #4, C++. Anyone can help me? still stuck test #4
Послано VNeo 15 июл 2017 10:59
Or I must use Array 2 dimensions?
Re: Acces Violation test #4 and after that get WA #4, C++. Anyone can help me? still stuck test #4
Послано Mahilewets 15 июл 2017 11:34
http://ideone.com/8vvdve
If you don't want runtime error #4 pay attention arrays in C/C++ are 0-indexing and enlarge your array by one for example

If you want AC you can AC even with one-d array


To do that you should write much more smart program than yours
Re: Acces Violation test #4 and after that get WA #4, C++. Anyone can help me? still stuck test #4
Послано VNeo 15 июл 2017 13:03
understood. thnks dude.

Edited by author 15.07.2017 13:05

Edited by author 15.07.2017 13:05