Submission #53372516


Source Code Expand

Copy
#include <cstdio>
#include <algorithm>
long long minus[300000];
long long input[300000];
int main(int argc, char * argv[]){
long long n;
long long ans=0;
long long del=0;
int i;
scanf("%lld", &n);
for(i=0; i<n; i++){
scanf("%lld", input+i);
ans+=input[i]*(n-1);
}
std::sort(input, input+n);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <cstdio>
#include <algorithm>

long long minus[300000];
long long input[300000];

int main(int argc, char * argv[]){
    long long n;
    long long ans=0;
    long long del=0;

    int i;

    scanf("%lld", &n);

    for(i=0; i<n; i++){
        scanf("%lld", input+i);
        ans+=input[i]*(n-1);
    }

    std::sort(input, input+n);

    int l=0, r=n-1;

    while(l<r){
        if(input[l]+input[r]>=100000000){
            r--;
            del+=r-l+1;
        }else{
            l++;
        }
    }

    printf("%lld", ans-del*100000000l);
    
    return 0;
}

Submission Info

Submission Time
Task C - Sigma Problem
User iluem100
Language C++ 20 (gcc 12.2)
Score 300
Code Size 611 Byte
Status AC
Exec Time 50 ms
Memory 4084 KB

Compile Error

Main.cpp: In function ‘int main(int, char**)’:
Main.cpp:7:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
    7 | int main(int argc, char * argv[]){
      |          ~~~~^~~~
Main.cpp:7:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
    7 | int main(int argc, char * argv[]){
      |                    ~~~~~~~^~~~~~
Main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%lld", &n);
      |     ~~~~~^~~~~~~~~~~~
Main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         scanf("%lld", input+i);
      |         ~~~~~^~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 22
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 1644 KB
00_sample_02.txt AC 0 ms 1640 KB
01_test_01.txt AC 50 ms 3984 KB
01_test_02.txt AC 49 ms 4052 KB
01_test_03.txt AC 50 ms 4084 KB
01_test_04.txt AC 50 ms 3964 KB
01_test_05.txt AC 50 ms 4048 KB
01_test_06.txt AC 49 ms 3952 KB
01_test_07.txt AC 49 ms 3980 KB
01_test_08.txt AC 49 ms 3964 KB
01_test_09.txt AC 48 ms 3932 KB
01_test_10.txt AC 49 ms 3932 KB
01_test_11.txt AC 39 ms 4076 KB
01_test_12.txt AC 17 ms 3992 KB
01_test_13.txt AC 25 ms 4040 KB
01_test_14.txt AC 6 ms 1904 KB
01_test_15.txt AC 50 ms 3952 KB
01_test_16.txt AC 32 ms 3176 KB
01_test_17.txt AC 1 ms 1616 KB
01_test_18.txt AC 1 ms 1708 KB
01_test_19.txt AC 35 ms 3952 KB
01_test_20.txt AC 35 ms 3956 KB


2025-03-18 (Tue)
07:48:00 +00:00