Submission #53479

# Submission time Handle Problem Language Result Execution time Memory
53479 2018-06-30T05:45:12 Z !?!?(#2015) Garage (IOI09_garage) C++11
0 / 100
5 ms 700 KB
#include<bits/stdc++.h>
using namespace std;
int N, M;
int R[101010];
int W[101010]; //R*W
int pos[101010];
queue<int> Q;
int main()
{
    scanf("%d%d", &N, &M);
    for(int i=1; i<=N; ++i)
        scanf("%d", R+i);
    for(int i=1; i<=M; ++i)
        scanf("%d", W+i);
    int ans = 0;
    for(int i=0; i<2*M; ++i)
    {
        int t; scanf("%d", &t);
        if(t>0)
            Q.push(t);
        else
        {
            for(int i=1; i<=N; ++i)
                if(pos[i] == -t) pos[i] = 0;
        }
        for(int i=1; i<=N; ++i)
        {
            if(pos[i] == 0 && !Q.empty())
            {
                pos[i] = Q.front(); Q.pop();
                ans += R[i] * W[pos[i]];
                printf("%d %d\n", i, pos[i]);
            }
        }
    }
    printf("%d\n", ans);
}

Compilation message

garage.cpp: In function 'int main()':
garage.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~
garage.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", R+i);
         ~~~~~^~~~~~~~~~~
garage.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", W+i);
         ~~~~~^~~~~~~~~~~
garage.cpp:18:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int t; scanf("%d", &t);
                ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 380 KB Output isn't correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Incorrect 2 ms 416 KB Output isn't correct
4 Incorrect 2 ms 436 KB Output isn't correct
5 Incorrect 2 ms 492 KB Output isn't correct
6 Incorrect 2 ms 568 KB Output isn't correct
7 Incorrect 3 ms 692 KB Output isn't correct
8 Incorrect 2 ms 692 KB Output isn't correct
9 Incorrect 2 ms 692 KB Output isn't correct
10 Incorrect 2 ms 692 KB Output isn't correct
11 Incorrect 3 ms 692 KB Output isn't correct
12 Incorrect 3 ms 692 KB Output isn't correct
13 Incorrect 2 ms 692 KB Output isn't correct
14 Incorrect 3 ms 692 KB Output isn't correct
15 Incorrect 3 ms 692 KB Output isn't correct
16 Incorrect 3 ms 692 KB Output isn't correct
17 Incorrect 3 ms 692 KB Output isn't correct
18 Incorrect 4 ms 692 KB Output isn't correct
19 Incorrect 5 ms 692 KB Output isn't correct
20 Incorrect 5 ms 700 KB Output isn't correct